Class MinimalCollection<E extends @Nullable Object>
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
@NullMarked
public class MinimalCollection<E extends @Nullable Object>
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
Modifier and TypeMethodDescriptionboolean
addAll
(Collection<? extends E> elementsToAdd) void
clear()
boolean
boolean
containsAll
(Collection<?> collection) iterator()
static <E extends @Nullable Object>
MinimalCollection<E> of
(E... contents) static <E extends @Nullable Object>
MinimalCollection<E> ofClassAndContents
(Class<? super @NonNull E> type, E... contents) boolean
removeAll
(Collection<?> elementsToRemove) boolean
retainAll
(Collection<?> elementsToRetain) int
size()
@Nullable 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 Details
-
of
-
ofClassAndContents
public static <E extends @Nullable Object> MinimalCollection<E> ofClassAndContents(Class<? super @NonNull E> type, E... contents) -
size
public int size()- Specified by:
size
in interfaceCollection<E extends @Nullable Object>
- Specified by:
size
in classAbstractCollection<E extends @Nullable Object>
-
contains
- Specified by:
contains
in interfaceCollection<E extends @Nullable Object>
- Overrides:
contains
in classAbstractCollection<E extends @Nullable Object>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E extends @Nullable Object>
- Overrides:
containsAll
in classAbstractCollection<E extends @Nullable Object>
-
iterator
-
toArray
- Specified by:
toArray
in interfaceCollection<E extends @Nullable Object>
- Overrides:
toArray
in classAbstractCollection<E extends @Nullable Object>
-
addAll
- Specified by:
addAll
in interfaceCollection<E extends @Nullable Object>
- Overrides:
addAll
in classAbstractCollection<E extends @Nullable Object>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E extends @Nullable Object>
- Overrides:
removeAll
in classAbstractCollection<E extends @Nullable Object>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E extends @Nullable Object>
- Overrides:
retainAll
in classAbstractCollection<E extends @Nullable Object>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E extends @Nullable Object>
- Overrides:
clear
in classAbstractCollection<E extends @Nullable Object>
-