Advertisement
Guest User

StatCollection (IDE warnings)

a guest
Feb 10th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. import java.util.Collection;
  2. import java.util.Iterator;
  3. import java.util.function.Supplier;
  4.  
  5. /**
  6.  * Created by loadedanvils on 2/10/16.
  7.  */
  8. public class StatCollection<E> implements Collection<E> {
  9.  
  10.     private Collection<E> collection;
  11.  
  12.     public StatCollection(Supplier<Collection<E>> collectionFactory) {
  13.         collection = collectionFactory.get();
  14.     }
  15.  
  16.  
  17.     @Override
  18.     public int size() {
  19.         return collection.size();
  20.     }
  21.  
  22.     @Override
  23.     public boolean isEmpty() {
  24.         return collection.isEmpty();
  25.     }
  26.  
  27.     @Override
  28.     public boolean contains(Object o) {
  29.         return collection.contains(o);
  30.     }
  31.  
  32.     @Override
  33.     public Iterator<E> iterator() {
  34.         return collection.iterator();
  35.     }
  36.  
  37.     @Override
  38.     public Object[] toArray() {
  39.         return collection.toArray();
  40.     }
  41.  
  42.     @Override
  43.     public <T> T[] toArray(T[] ts) {
  44.         return collection.toArray(ts);
  45.     }
  46.  
  47.     @Override
  48.     public boolean add(E e) {
  49.         return collection.add(e);
  50.     }
  51.  
  52.     @Override
  53.     public boolean remove(Object o) {
  54.         return collection.remove(o);
  55.     }
  56.  
  57.     @Override
  58.     public boolean containsAll(Collection<?> collection) {
  59.         return this.collection.containsAll(collection);
  60.     }
  61.  
  62.     @Override
  63.     public boolean addAll(Collection<? extends E> collection) {
  64.         return this.collection.addAll(collection);
  65.     }
  66.  
  67.     @Override
  68.     public boolean removeAll(Collection<?> collection) {
  69.         return this.collection.removeAll(collection);
  70.     }
  71.  
  72.     @Override
  73.     public boolean retainAll(Collection<?> collection) {
  74.         return this.collection.retainAll(collection);
  75.     }
  76.  
  77.     @Override
  78.     public void clear() {
  79.         collection.clear();
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement