|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.Constraints
@Beta @GwtCompatible public final class Constraints
Factories and utilities pertaining to the Constraint
interface.
MapConstraints
Method Summary | ||
---|---|---|
static
|
constrainedCollection(Collection<E> collection,
Constraint<? super E> constraint)
Returns a constrained view of the specified collection, using the specified constraint. |
|
static
|
constrainedList(List<E> list,
Constraint<? super E> constraint)
Returns a constrained view of the specified list, using the specified constraint. |
|
static
|
constrainedMultiset(Multiset<E> multiset,
Constraint<? super E> constraint)
Returns a constrained view of the specified multiset, using the specified constraint. |
|
static
|
constrainedSet(Set<E> set,
Constraint<? super E> constraint)
Returns a constrained view of the specified set, using the specified constraint. |
|
static
|
constrainedSortedSet(SortedSet<E> sortedSet,
Constraint<? super E> constraint)
Returns a constrained view of the specified sorted set, using the specified constraint. |
|
static
|
notNull()
Returns a constraint that verifies that the element is not null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <E> Constraint<E> notNull()
NullPointerException
is thrown.
public static <E> Collection<E> constrainedCollection(Collection<E> collection, Constraint<? super E> constraint)
The returned collection is not serializable.
collection
- the collection to constrainconstraint
- the constraint that validates added elements
public static <E> Set<E> constrainedSet(Set<E> set, Constraint<? super E> constraint)
The returned set is not serializable.
set
- the set to constrainconstraint
- the constraint that validates added elements
public static <E> SortedSet<E> constrainedSortedSet(SortedSet<E> sortedSet, Constraint<? super E> constraint)
The returned set is not serializable.
sortedSet
- the sorted set to constrainconstraint
- the constraint that validates added elements
public static <E> List<E> constrainedList(List<E> list, Constraint<? super E> constraint)
If list
implements RandomAccess
, so will the returned
list. The returned list is not serializable.
list
- the list to constrainconstraint
- the constraint that validates added elements
public static <E> Multiset<E> constrainedMultiset(Multiset<E> multiset, Constraint<? super E> constraint)
The returned multiset is not serializable.
multiset
- the multiset to constrainconstraint
- the constraint that validates added elements
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |