// Path: autoadapter/src/main/java/com/benny/library/autoadapter/factory/Factory.java
// public interface Factory<T> {
//     T create();
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/factory/MockViewHolerFactory.java
// public class MockViewHolerFactory<T> implements Factory<IViewHolder<T>> {
//     @Override
//     public IViewHolder<T> create() {
//         return new MockViewHolder<T>();
//     }
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/utils/Func3.java
// public interface Func3<T1, T2, T3, R> {
//     R call(T1 t1, T2 t2, T3 t3);
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/MockViewHolder.java
// public class MockViewHolder<T> implements IViewHolder<T> {
//     @Override
//     public void bind(View view) {
//     }
// 
//     @Override
//     public void onDataChange(DataGetter<T> getter, int position) {
//     }
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/IViewHolder.java
// public interface IViewHolder<T> {
//     void bind(View view);
//     void onDataChange(DataGetter<T> getter, int position);
// }


import android.view.View;
import android.view.ViewGroup;
import com.benny.library.autoadapter.factory.Factory;
import com.benny.library.autoadapter.factory.MockViewHolerFactory;
import com.benny.library.autoadapter.utils.Func3;
import com.benny.library.autoadapter.viewholder.MockViewHolder;
import com.benny.library.autoadapter.viewholder.IViewHolder;
import java.util.ArrayList;
import java.util.List;
            return this;
        }

        public Builder<T> addFilter(IViewCreator<T> viewCreator) {
            defaultViewCreator = viewCreator;
            return this;
        }

        public Builder<T> addFilter(int resId, Factory<? extends IViewHolder<T>> factory) {
            defaultViewCreator = new ViewCreator<T>(resId, factory);
            return this;
        }

        public Builder<T> addFilter(Func3<T, Integer, Integer, Boolean> filter, int resId, Factory<? extends IViewHolder<T>> factory) {
            viewTypeFilters.add(new ViewTypeFilter<T>(filter, new ViewCreator<T>(resId, factory), viewTypeFilters.size()));
            return this;
        }

        public Builder<T> addFilter(Func3<T, Integer, Integer, Boolean> filter, IViewCreator<T> viewCreator) {
            viewTypeFilters.add(new ViewTypeFilter<T>(filter, viewCreator, viewTypeFilters.size()));
            return this;
        }

        public ViewCreatorCollection<T> build() {
            if(loadingResId != -1) {
                viewTypeFilters.add(new ViewTypeFilter<T>(new Func3<T, Integer, Integer, Boolean>() {
                    @Override
                    public Boolean call(T data, Integer position, Integer itemCount) {
                        return data == null && position == itemCount - 1;
                    }
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/factory/Factory.java
// public interface Factory<T> {
//     T create();
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/factory/MockViewHolerFactory.java
// public class MockViewHolerFactory<T> implements Factory<IViewHolder<T>> {
//     @Override
//     public IViewHolder<T> create() {
//         return new MockViewHolder<T>();
//     }
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/utils/Func3.java
// public interface Func3<T1, T2, T3, R> {
//     R call(T1 t1, T2 t2, T3 t3);
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/MockViewHolder.java
// public class MockViewHolder<T> implements IViewHolder<T> {
//     @Override
//     public void bind(View view) {
//     }
// 
//     @Override
//     public void onDataChange(DataGetter<T> getter, int position) {
//     }
// }
// 
// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewholder/IViewHolder.java
// public interface IViewHolder<T> {
//     void bind(View view);
//     void onDataChange(DataGetter<T> getter, int position);
// }


// Path: autoadapter/src/main/java/com/benny/library/autoadapter/viewcreator/ViewCreatorCollection.java
import android.view.View;
import android.view.ViewGroup;
import com.benny.library.autoadapter.factory.Factory;
import com.benny.library.autoadapter.factory.MockViewHolerFactory;
import com.benny.library.autoadapter.utils.Func3;
import com.benny.library.autoadapter.viewholder.MockViewHolder;
import com.benny.library.autoadapter.viewholder.IViewHolder;
import java.util.ArrayList;
import java.util.List;

            return this;
        }

        public Builder<T> addFilter(IViewCreator<T> viewCreator) {
            defaultViewCreator = viewCreator;
            return this;
        }

        public Builder<T> addFilter(int resId, Factory<? extends IViewHolder<T>> factory) {
            defaultViewCreator = new ViewCreator<T>(resId, factory);
            return this;
        }

        public Builder<T> addFilter(Func3<T, Integer, Integer, Boolean> filter, int resId, Factory<? extends IViewHolder<T>> factory) {
            viewTypeFilters.add(new ViewTypeFilter<T>(filter, new ViewCreator<T>(resId, factory), viewTypeFilters.size()));
            return this;
        }

        public Builder<T> addFilter(Func3<T, Integer, Integer, Boolean> filter, IViewCreator<T> viewCreator) {
            viewTypeFilters.add(new ViewTypeFilter<T>(filter, viewCreator, viewTypeFilters.size()));
            return this;
        }

        public ViewCreatorCollection<T> build() {
            if(loadingResId != -1) {
                viewTypeFilters.add(new ViewTypeFilter<T>(new Func3<T, Integer, Integer, Boolean>() {
                    @Override
                    public Boolean call(T data, Integer position, Integer itemCount) {
                        return data == null && position == itemCount - 1;
                    }
                }, new ViewCreator<T>(loadingResId, new MockViewHolerFactory<T>()), viewTypeFilters.size()));