|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.MapConstraints
@Beta @GwtCompatible public final class MapConstraints
Factory and utilities pertaining to the MapConstraint
interface.
Constraints
Method Summary | ||
---|---|---|
static
|
constrainedBiMap(BiMap<K,V> map,
MapConstraint<? super K,? super V> constraint)
Returns a constrained view of the specified bimap, using the specified constraint. |
|
static
|
constrainedListMultimap(ListMultimap<K,V> multimap,
MapConstraint<? super K,? super V> constraint)
Returns a constrained view of the specified list multimap, using the specified constraint. |
|
static
|
constrainedMap(Map<K,V> map,
MapConstraint<? super K,? super V> constraint)
Returns a constrained view of the specified map, using the specified constraint. |
|
static
|
constrainedMultimap(Multimap<K,V> multimap,
MapConstraint<? super K,? super V> constraint)
Returns a constrained view of the specified multimap, using the specified constraint. |
|
static
|
constrainedSetMultimap(SetMultimap<K,V> multimap,
MapConstraint<? super K,? super V> constraint)
Returns a constrained view of the specified set multimap, using the specified constraint. |
|
static
|
constrainedSortedSetMultimap(SortedSetMultimap<K,V> multimap,
MapConstraint<? super K,? super V> constraint)
Returns a constrained view of the specified sorted-set multimap, using the specified constraint. |
|
static MapConstraint<Object,Object> |
notNull()
Returns a constraint that verifies that neither the key nor the value is null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MapConstraint<Object,Object> notNull()
NullPointerException
is thrown.
public static <K,V> Map<K,V> constrainedMap(Map<K,V> map, MapConstraint<? super K,? super V> constraint)
The returned map is not serializable.
map
- the map to constrainconstraint
- the constraint that validates added entries
public static <K,V> Multimap<K,V> constrainedMultimap(Multimap<K,V> multimap, MapConstraint<? super K,? super V> constraint)
Note that the generated multimap's Multimap.removeAll(java.lang.Object)
and
Multimap.replaceValues(K, java.lang.Iterable extends V>)
methods return collections that are not
constrained.
The returned multimap is not serializable.
multimap
- the multimap to constrainconstraint
- the constraint that validates added entries
public static <K,V> ListMultimap<K,V> constrainedListMultimap(ListMultimap<K,V> multimap, MapConstraint<? super K,? super V> constraint)
Note that the generated multimap's Multimap.removeAll(java.lang.Object)
and
Multimap.replaceValues(K, java.lang.Iterable extends V>)
methods return collections that are not
constrained.
The returned multimap is not serializable.
multimap
- the multimap to constrainconstraint
- the constraint that validates added entries
public static <K,V> SetMultimap<K,V> constrainedSetMultimap(SetMultimap<K,V> multimap, MapConstraint<? super K,? super V> constraint)
Note that the generated multimap's Multimap.removeAll(java.lang.Object)
and
Multimap.replaceValues(K, java.lang.Iterable extends V>)
methods return collections that are not
constrained.
The returned multimap is not serializable.
multimap
- the multimap to constrainconstraint
- the constraint that validates added entries
public static <K,V> SortedSetMultimap<K,V> constrainedSortedSetMultimap(SortedSetMultimap<K,V> multimap, MapConstraint<? super K,? super V> constraint)
Note that the generated multimap's Multimap.removeAll(java.lang.Object)
and
Multimap.replaceValues(K, java.lang.Iterable extends V>)
methods return collections that are not
constrained.
The returned multimap is not serializable.
multimap
- the multimap to constrainconstraint
- the constraint that validates added entries
public static <K,V> BiMap<K,V> constrainedBiMap(BiMap<K,V> map, MapConstraint<? super K,? super V> constraint)
The returned bimap is not serializable.
map
- the bimap to constrainconstraint
- the constraint that validates added entries
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |