@Beta @GwtCompatible public final class MapConstraints extends Object
MapConstraint interface.
Constraints
| Modifier and Type | Method and Description |
|---|---|
static <K |
constrainedBiMap(BiMap
Returns a constrained view of the specified bimap, using the specified constraint.
|
static <K |
constrainedListMultimap(ListMultimap
Returns a constrained view of the specified list multimap, using the specified constraint.
|
static <K |
constrainedMap(Map
Returns a constrained view of the specified map, using the specified constraint.
|
static <K |
constrainedMultimap(Multimap
Returns a constrained view of the specified multimap, using the specified constraint.
|
static <K |
constrainedSetMultimap(SetMultimap
Returns a constrained view of the specified set multimap, using the specified constraint.
|
static <K |
constrainedSortedSetMultimap(SortedSetMultimap
Returns a constrained view of the specified sorted-set multimap, using the specified constraint.
|
static MapConstraint |
notNull()
Returns a constraint that verifies that neither the key nor the value is null.
|
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 constrain
constraint - 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 and Multimap methods return collections that are not constrained.
The returned multimap is not serializable.
multimap - the multimap to constrain
constraint - 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 and Multimap methods return collections that are not constrained.
The returned multimap is not serializable.
multimap - the multimap to constrain
constraint - 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 and Multimap methods return collections that are not constrained.
The returned multimap is not serializable.
multimap - the multimap to constrain
constraint - 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 and Multimap methods return collections that are not constrained.
The returned multimap is not serializable.
multimap - the multimap to constrain
constraint - 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 constrain
constraint - the constraint that validates added entries