@BindingAdapter({"entries", "layout"})
    public static <T> void setEntries(ViewGroup viewGroup,
            List<T> oldEntries, int oldLayoutId,
            List<T> newEntries, int newLayoutId) {
        if (oldEntries == newEntries && oldLayoutId == newLayoutId) {
            return; // nothing has changed
        }

        EntryChangeListener listener =
                ListenerUtil.getListener(viewGroup, R.id.entryListener);
        if (oldEntries != newEntries && listener != null && oldEntries instanceof ObservableList) {
            ((ObservableList)oldEntries).removeOnListChangedCallback(listener);
        }

        if (newEntries == null) {
            viewGroup.removeAllViews();
        } else {
            if (newEntries instanceof ObservableList) {
                if (listener == null) {
                    listener =
                            new EntryChangeListener(viewGroup, newLayoutId);
                    ListenerUtil.trackListener(viewGroup, listener,
                            R.id.entryListener);
                } else {
                    listener.setLayoutId(newLayoutId);
                }
                if (newEntries != oldEntries) {
                    ((ObservableList)newEntries).addOnListChangedCallback(listener);
                }
            }
            resetViews(viewGroup, newLayoutId, newEntries);
        }
    }
Assign a list of items to a ViewGroup. This is used with the {@code entries} and
{@code layout} attributes in the application namespace. Example Usage:
<pre><code>&lt;LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:entries="@{items}"
    app:layout="@{@layout/item}"/&gt;
</code></pre>
<p>
In the above, {@code items} is a List or ObservableList. {@code layout} does not
need to be hard-coded, but most commonly will be. This BindingAdapter will work
with any ViewGroup that only needs addView() and removeView() to manage its Views.
<p>
The layout, &commat;layout/item for example, must have a single variable named
{@code data}.
DataBindingDataBoundList/app/src/main/java/com/example/android/databoundlist/ListBindingAdapters.java