// Path: agera/src/main/java/com/google/android/agera/Observables.java
// @NonNull
// public static Observable compositeObservable(@NonNull final Observable... observables) {
//   return compositeObservable(0, observables);
// }


import static com.google.android.agera.Observables.compositeObservable;
import static com.google.android.agera.Preconditions.checkArgument;
import static com.google.android.agera.Preconditions.checkNotNull;
import static com.google.android.agera.Preconditions.checkState;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application.ActivityLifecycleCallbacks;
import android.os.Bundle;
import android.support.annotation.IntDef;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.util.ListUpdateCallback;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.Adapter;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.google.android.agera.Observable;
import com.google.android.agera.Repository;
import com.google.android.agera.Updatable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
  private final Part[] parts;
  @NonNull
  private final Map<ViewHolder, Part> partForViewHolder;
  @NonNull
  private final Observable additionalObservables;
  @NonNull
  private final int[] endPositions;

  /**
   * Whether getItemCount has not been called since adapter creation or since the last
   * notifyDataSetChanged event. This flag being true suppresses all adapter events; and data
   * updates will be performed at getItemCount.
   */
  private boolean dataInvalid;
  private int resolvedPartIndex;
  private int resolvedItemIndex;

  public RepositoryAdapter(@NonNull final Builder builder) {
    final int partCount = builder.parts.size();
    checkArgument(partCount > 0, "Must add at least one part");

    this.partCount = partCount;
    this.staticItemCount = builder.staticItemCount;
    this.parts = new Part[partCount];
    for (int i = 0; i < partCount; i++) {
      final Part part = builder.parts.get(i);
      parts[i] = part;
      part.attach(this, i);
    }
    this.partForViewHolder = new IdentityHashMap<>();
// Path: agera/src/main/java/com/google/android/agera/Observables.java
// @NonNull
// public static Observable compositeObservable(@NonNull final Observable... observables) {
//   return compositeObservable(0, observables);
// }


// Path: extensions/rvadapter/src/main/java/com/google/android/agera/rvadapter/RepositoryAdapter.java
import static com.google.android.agera.Observables.compositeObservable;
import static com.google.android.agera.Preconditions.checkArgument;
import static com.google.android.agera.Preconditions.checkNotNull;
import static com.google.android.agera.Preconditions.checkState;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application.ActivityLifecycleCallbacks;
import android.os.Bundle;
import android.support.annotation.IntDef;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.util.ListUpdateCallback;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.Adapter;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.google.android.agera.Observable;
import com.google.android.agera.Repository;
import com.google.android.agera.Updatable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;

  private final Part[] parts;
  @NonNull
  private final Map<ViewHolder, Part> partForViewHolder;
  @NonNull
  private final Observable additionalObservables;
  @NonNull
  private final int[] endPositions;

  /**
   * Whether getItemCount has not been called since adapter creation or since the last
   * notifyDataSetChanged event. This flag being true suppresses all adapter events; and data
   * updates will be performed at getItemCount.
   */
  private boolean dataInvalid;
  private int resolvedPartIndex;
  private int resolvedItemIndex;

  public RepositoryAdapter(@NonNull final Builder builder) {
    final int partCount = builder.parts.size();
    checkArgument(partCount > 0, "Must add at least one part");

    this.partCount = partCount;
    this.staticItemCount = builder.staticItemCount;
    this.parts = new Part[partCount];
    for (int i = 0; i < partCount; i++) {
      final Part part = builder.parts.get(i);
      parts[i] = part;
      part.attach(this, i);
    }
    this.partForViewHolder = new IdentityHashMap<>();
    this.additionalObservables = compositeObservable(