package ca.antonious.habittracker;

import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created by George on 2016-09-02.
 */
public abstract class ArrayAdapter<T, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
    private List<T> items = new ArrayList<>();

    public abstract VH onCreateViewHolder(ViewGroup parent, int viewType);
    public abstract void onBindViewHolder(VH holder, int position);

    @Override
    public int getItemCount() {
        return items.size();
    }

    public T get(int position) {
        return items.get(position);
    }

    public void clear() {
        items.clear();
    }

    public void add(T object) {
        items.add(object);
    }

    public void addAll(Collection<? extends T> collection) {
        items.addAll(collection);
    }
}

@@ -914,11 +914,136 @@
 );%0A    %7D
+%0A%0A    public void setAll(Collection%3C? extends T%3E collection) %7B%0A        items.clear();%0A        items.addAll(collection);%0A    %7D
 %0A%7D%0A

Add method to set all items in an ArrayAdapter