Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Collection;
- import java.util.Iterator;
- import java.util.function.Supplier;
- /**
- * Created by loadedanvils on 2/10/16.
- */
- public class StatCollection<E> implements Collection<E> {
- private Collection<E> collection;
- public StatCollection(Supplier<Collection<E>> collectionFactory) {
- collection = collectionFactory.get();
- }
- @Override
- public int size() {
- return collection.size();
- }
- @Override
- public boolean isEmpty() {
- return collection.isEmpty();
- }
- @Override
- public boolean contains(Object o) {
- return collection.contains(o);
- }
- @Override
- public Iterator<E> iterator() {
- return collection.iterator();
- }
- @Override
- public Object[] toArray() {
- return collection.toArray();
- }
- @Override
- public <T> T[] toArray(T[] ts) {
- return collection.toArray(ts);
- }
- @Override
- public boolean add(E e) {
- return collection.add(e);
- }
- @Override
- public boolean remove(Object o) {
- return collection.remove(o);
- }
- @Override
- public boolean containsAll(Collection<?> collection) {
- return this.collection.containsAll(collection);
- }
- @Override
- public boolean addAll(Collection<? extends E> collection) {
- return this.collection.addAll(collection);
- }
- @Override
- public boolean removeAll(Collection<?> collection) {
- return this.collection.removeAll(collection);
- }
- @Override
- public boolean retainAll(Collection<?> collection) {
- return this.collection.retainAll(collection);
- }
- @Override
- public void clear() {
- collection.clear();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement