Class MinimalCollection<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- com.google.common.collect.testing.MinimalCollection<E>
-
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
- Direct Known Subclasses:
MinimalSet
@GwtCompatible public class MinimalCollection<E> extends AbstractCollection<E>
A simplistic collection which implements only the bare minimum allowed by the spec, and throws exceptions whenever it can.- Author:
- Kevin Bourrillion
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addAll(Collection<? extends E> elementsToAdd)
void
clear()
boolean
contains(Object object)
boolean
containsAll(Collection<?> collection)
Iterator<E>
iterator()
static <E> MinimalCollection<E>
of(E... contents)
static <E> MinimalCollection<E>
ofClassAndContents(Class<? super E> type, E... contents)
boolean
removeAll(Collection<?> elementsToRemove)
boolean
retainAll(Collection<?> elementsToRetain)
int
size()
Object[]
toArray()
-
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
-
-
-
-
Method Detail
-
of
public static <E> MinimalCollection<E> of(E... contents)
-
ofClassAndContents
public static <E> MinimalCollection<E> ofClassAndContents(Class<? super E> type, E... contents)
-
size
public int size()
- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in classAbstractCollection<E>
-
contains
public boolean contains(Object object)
- Specified by:
contains
in interfaceCollection<E>
- Overrides:
contains
in classAbstractCollection<E>
-
containsAll
public boolean containsAll(Collection<?> collection)
- Specified by:
containsAll
in interfaceCollection<E>
- Overrides:
containsAll
in classAbstractCollection<E>
-
iterator
public Iterator<E> iterator()
- Specified by:
iterator
in interfaceCollection<E>
- Specified by:
iterator
in interfaceIterable<E>
- Specified by:
iterator
in classAbstractCollection<E>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
addAll
public boolean addAll(Collection<? extends E> elementsToAdd)
- Specified by:
addAll
in interfaceCollection<E>
- Overrides:
addAll
in classAbstractCollection<E>
-
removeAll
public boolean removeAll(Collection<?> elementsToRemove)
- Specified by:
removeAll
in interfaceCollection<E>
- Overrides:
removeAll
in classAbstractCollection<E>
-
retainAll
public boolean retainAll(Collection<?> elementsToRetain)
- Specified by:
retainAll
in interfaceCollection<E>
- Overrides:
retainAll
in classAbstractCollection<E>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<E>
- Overrides:
clear
in classAbstractCollection<E>
-
-