Package com.google.common.collect
Class MapConstraints
- java.lang.Object
-
- com.google.common.collect.MapConstraints
-
@Beta @GwtCompatible @Deprecated public final class MapConstraints extends java.lang.Object
Deprecated.UsePreconditions
for basic checks. In place of constrained maps, we encourage you to check your preconditions explicitly instead of leaving that work to the map implementation. For the specific case of rejecting null, considerImmutableMap
. This class is scheduled for removal in Guava 21.0.Factory and utilities pertaining to theMapConstraint
interface.- Since:
- 3.0
- See Also:
Constraints
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <K,V>
ListMultimap<K,V>constrainedListMultimap(ListMultimap<K,V> multimap, MapConstraint<? super K,? super V> constraint)
Deprecated.Returns a constrained view of the specified list multimap, using the specified constraint.static <K,V>
java.util.Map<K,V>constrainedMap(java.util.Map<K,V> map, MapConstraint<? super K,? super V> constraint)
Deprecated.Returns a constrained view of the specified map, using the specified constraint.
-
-
-
Method Detail
-
constrainedMap
public static <K,V> java.util.Map<K,V> constrainedMap(java.util.Map<K,V> map, MapConstraint<? super K,? super V> constraint)
Deprecated.Returns a constrained view of the specified map, using the specified constraint. Any operations that add new mappings will call the provided constraint. However, this method does not verify that existing mappings satisfy the constraint.The returned map is not serializable.
- Parameters:
map
- the map to constrainconstraint
- the constraint that validates added entries- Returns:
- a constrained view of the specified map
-
constrainedListMultimap
public static <K,V> ListMultimap<K,V> constrainedListMultimap(ListMultimap<K,V> multimap, MapConstraint<? super K,? super V> constraint)
Deprecated.Returns a constrained view of the specified list multimap, using the specified constraint. Any operations that add new mappings will call the provided constraint. However, this method does not verify that existing mappings satisfy the constraint.Note that the generated multimap's
Multimap.removeAll(java.lang.Object)
andMultimap.replaceValues(K, java.lang.Iterable<? extends V>)
methods return collections that are not constrained.The returned multimap is not serializable.
- Parameters:
multimap
- the multimap to constrainconstraint
- the constraint that validates added entries- Returns:
- a constrained view of the specified multimap
-
-