Package com.google.common.collect
Class Constraints.ConstrainedCollection<E>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingCollection<E>
-
- com.google.common.collect.Constraints.ConstrainedCollection<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
- Enclosing class:
- Constraints
static class Constraints.ConstrainedCollection<E> extends ForwardingCollection<E>
-
-
Field Summary
Fields Modifier and Type Field Description private Constraint<? super E>
constraint
private java.util.Collection<E>
delegate
-
Constructor Summary
Constructors Constructor Description ConstrainedCollection(java.util.Collection<E> delegate, Constraint<? super E> constraint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E element)
boolean
addAll(java.util.Collection<? extends E> elements)
protected java.util.Collection<E>
delegate()
Returns the backing delegate instance that methods are forwarded to.-
Methods inherited from class com.google.common.collect.ForwardingCollection
clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
delegate
private final java.util.Collection<E> delegate
-
constraint
private final Constraint<? super E> constraint
-
-
Constructor Detail
-
ConstrainedCollection
public ConstrainedCollection(java.util.Collection<E> delegate, Constraint<? super E> constraint)
-
-
Method Detail
-
delegate
protected java.util.Collection<E> delegate()
Description copied from class:ForwardingObject
Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such asForwardingSet.delegate()
. Concrete subclasses override this method to supply the instance being decorated.- Specified by:
delegate
in classForwardingCollection<E>
-
add
public boolean add(E element)
- Specified by:
add
in interfacejava.util.Collection<E>
- Overrides:
add
in classForwardingCollection<E>
-
addAll
public boolean addAll(java.util.Collection<? extends E> elements)
- Specified by:
addAll
in interfacejava.util.Collection<E>
- Overrides:
addAll
in classForwardingCollection<E>
-
-