// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/listener/IForwardingListener.java
// public interface IForwardingListener<
//         A extends RecyclerView.Adapter<? extends VH>,
//         VH extends RecyclerView.ViewHolder> {
//     void setProvider(@NonNull IProvider<A, VH> provider);
// 
//     interface IProvider<A extends RecyclerView.Adapter<? extends VH>, VH extends RecyclerView.ViewHolder> {
//         @NonNull
//         A getAdapter();
// 
//         @Nullable
//         RecyclerView getAttachedRecyclerView();
//     }
// }


import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import net.cattaka.android.adaptertoolbox.adapter.listener.IForwardingListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
    public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
        super.onDetachedFromRecyclerView(recyclerView);
        mProviderMap.remove(recyclerView);
        mForwardingListenersMap.remove(recyclerView);
    }

    protected IForwardingListener.IProvider<SA, VH> getProvider(View parent) {
        IForwardingListener.IProvider<SA, VH> provider = mProviderMap.get(parent);
        return (provider != null) ? provider : mNullProvider;
    }

    @SuppressWarnings("unchecked")
    @NonNull
    public SA getSelf() {
        return (SA) this;
    }

    public int getViewTypeCount() {
        return mViewHolderFactory.size();
    }

    @Nullable
    public abstract FL createForwardingListener(@NonNull IViewHolderFactory<SA, VH, FL, ?> viewHolderFactory);

    @NonNull
    public abstract VH createNullViewHolder();

    public interface IViewHolderFactory<
            SA extends AbsScrambleAdapter<?, SA, VH, ?, ?>,
            VH extends RecyclerView.ViewHolder,
// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/listener/IForwardingListener.java
// public interface IForwardingListener<
//         A extends RecyclerView.Adapter<? extends VH>,
//         VH extends RecyclerView.ViewHolder> {
//     void setProvider(@NonNull IProvider<A, VH> provider);
// 
//     interface IProvider<A extends RecyclerView.Adapter<? extends VH>, VH extends RecyclerView.ViewHolder> {
//         @NonNull
//         A getAdapter();
// 
//         @Nullable
//         RecyclerView getAttachedRecyclerView();
//     }
// }


// Path: adapter-toolbox/src/main/java/net/cattaka/android/adaptertoolbox/adapter/AbsScrambleAdapter.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import net.cattaka.android.adaptertoolbox.adapter.listener.IForwardingListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

    public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
        super.onDetachedFromRecyclerView(recyclerView);
        mProviderMap.remove(recyclerView);
        mForwardingListenersMap.remove(recyclerView);
    }

    protected IForwardingListener.IProvider<SA, VH> getProvider(View parent) {
        IForwardingListener.IProvider<SA, VH> provider = mProviderMap.get(parent);
        return (provider != null) ? provider : mNullProvider;
    }

    @SuppressWarnings("unchecked")
    @NonNull
    public SA getSelf() {
        return (SA) this;
    }

    public int getViewTypeCount() {
        return mViewHolderFactory.size();
    }

    @Nullable
    public abstract FL createForwardingListener(@NonNull IViewHolderFactory<SA, VH, FL, ?> viewHolderFactory);

    @NonNull
    public abstract VH createNullViewHolder();

    public interface IViewHolderFactory<
            SA extends AbsScrambleAdapter<?, SA, VH, ?, ?>,
            VH extends RecyclerView.ViewHolder,
            FL extends IForwardingListener<SA, VH>,