Class MinimalCollection<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>
    Direct Known Subclasses:
    MinimalSet

    @GwtCompatible
    public class MinimalCollection<E>
    extends java.util.AbstractCollection<E>
    A simplistic collection which implements only the bare minimum allowed by the spec, and throws exceptions whenever it can.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addAll​(java.util.Collection<? extends E> elementsToAdd)  
      void clear()  
      boolean contains​(java.lang.Object object)  
      boolean containsAll​(java.util.Collection<?> collection)  
      java.util.Iterator<E> iterator()  
      static <E> MinimalCollection<E> of​(E... contents)  
      static <E> MinimalCollection<E> ofClassAndContents​(java.lang.Class<? super E> type, E... contents)  
      boolean removeAll​(java.util.Collection<?> elementsToRemove)  
      boolean retainAll​(java.util.Collection<?> elementsToRetain)  
      int size()  
      java.lang.Object[] toArray()  
      • Methods inherited from class java.util.AbstractCollection

        add, isEmpty, remove, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Method Detail

      • ofClassAndContents

        public static <E> MinimalCollection<E> ofClassAndContents​(java.lang.Class<? super E> type,
                                                                  E... contents)
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E>
        Specified by:
        size in class java.util.AbstractCollection<E>
      • contains

        public boolean contains​(java.lang.Object object)
        Specified by:
        contains in interface java.util.Collection<E>
        Overrides:
        contains in class java.util.AbstractCollection<E>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> collection)
        Specified by:
        containsAll in interface java.util.Collection<E>
        Overrides:
        containsAll in class java.util.AbstractCollection<E>
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E>
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Specified by:
        iterator in class java.util.AbstractCollection<E>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<E>
        Overrides:
        toArray in class java.util.AbstractCollection<E>
      • addAll

        public boolean addAll​(java.util.Collection<? extends E> elementsToAdd)
        Specified by:
        addAll in interface java.util.Collection<E>
        Overrides:
        addAll in class java.util.AbstractCollection<E>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> elementsToRemove)
        Specified by:
        removeAll in interface java.util.Collection<E>
        Overrides:
        removeAll in class java.util.AbstractCollection<E>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> elementsToRetain)
        Specified by:
        retainAll in interface java.util.Collection<E>
        Overrides:
        retainAll in class java.util.AbstractCollection<E>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E>
        Overrides:
        clear in class java.util.AbstractCollection<E>