Created
September 2, 2015 08:17
-
-
Save Sirelon/92f7d7001d3f6d7090e0 to your computer and use it in GitHub Desktop.
Class wrapper for the interface Model and List.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sirelon; | |
import android.support.annotation.NonNull; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.ListIterator; | |
/** | |
* @author romanishin | |
* @since 02.09.15. | |
*/ | |
public class ModelsList<T extends Model> implements Model, List<T> { | |
private final List<T> mList; | |
public ModelsList(int size) { | |
mList = new ArrayList<>(size); | |
} | |
@Override | |
public void add(int location, T object) { | |
mList.add(location, object); | |
} | |
@Override | |
public boolean add(T object) { | |
return mList.add(object); | |
} | |
@Override | |
public boolean addAll(int location, Collection<? extends T> collection) { | |
return mList.addAll(location, collection); | |
} | |
@Override | |
public boolean addAll(Collection<? extends T> collection) { | |
return mList.addAll(collection); | |
} | |
@Override | |
public void clear() { | |
mList.clear(); | |
} | |
@Override | |
public boolean contains(Object object) { | |
return mList.contains(object); | |
} | |
@Override | |
public boolean containsAll(Collection<?> collection) { | |
return mList.containsAll(collection); | |
} | |
@Override | |
public T get(int location) { | |
return mList.get(location); | |
} | |
@Override | |
public int indexOf(Object object) { | |
return mList.indexOf(object); | |
} | |
@Override | |
public boolean isEmpty() { | |
return mList.isEmpty(); | |
} | |
@NonNull | |
@Override | |
public Iterator<T> iterator() { | |
return mList.iterator(); | |
} | |
@Override | |
public int lastIndexOf(Object object) { | |
return mList.lastIndexOf(object); | |
} | |
@Override | |
public ListIterator<T> listIterator() { | |
return mList.listIterator(); | |
} | |
@NonNull | |
@Override | |
public ListIterator<T> listIterator(int location) { | |
return mList.listIterator(location); | |
} | |
@Override | |
public T remove(int location) { | |
return mList.remove(location); | |
} | |
@Override | |
public boolean remove(Object object) { | |
return mList.remove(object); | |
} | |
@Override | |
public boolean removeAll(Collection<?> collection) { | |
return mList.removeAll(collection); | |
} | |
@Override | |
public boolean retainAll(Collection<?> collection) { | |
return mList.retainAll(collection); | |
} | |
@Override | |
public T set(int location, T object) { | |
return mList.set(location, object); | |
} | |
@Override | |
public int size() { | |
return mList.size(); | |
} | |
@NonNull | |
@Override | |
public List<T> subList(int start, int end) { | |
return mList.subList(start, end); | |
} | |
@NonNull | |
@Override | |
public Object[] toArray() { | |
return mList.toArray(); | |
} | |
@NonNull | |
@Override | |
public <T1> T1[] toArray(T1[] array) { | |
return mList.toArray(array); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment