Class ManMapExt
- java.lang.Object
-
- manifold.collections.extensions.java.util.Map.ManMapExt
-
public class ManMapExt extends Object
-
-
Constructor Summary
Constructors Constructor Description ManMapExt()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
Map<K,V>mapOf(manifold.rt.api.util.Pair<K,V>... entries)For use with thekey and valuebinding expression syntax usingPair.and.static <K,V>
Vset(Map<K,V> thiz, K key, V value)Implements the indexed assignment operator for Map to enable the syntax:map[key] = value
-
-
-
Method Detail
-
set
public static <K,V> V set(Map<K,V> thiz, K key, V value)
Implements the indexed assignment operator for Map to enable the syntax:map[key] = value- Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
- the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)
- Throws:
UnsupportedOperationException- if the put operation is not supported by this mapClassCastException- if the class of the specified key or value prevents it from being stored in this mapNullPointerException- if the specified key or value is null and this map does not permit null keys or valuesIllegalArgumentException- if some property of the specified key or value prevents it from being stored in this map- See Also:
Map.put(Object, Object)
-
mapOf
@SafeVarargs public static <K,V> Map<K,V> mapOf(manifold.rt.api.util.Pair<K,V>... entries)
For use with thekey and valuebinding expression syntax usingPair.and.
Returns a new read-only map with the specified contents, given as a list of pairs where the first value is the key and the second is the value. If multiple pairs have the same key, the resulting map will contain the value from the last of those pairs. Entries of the map are iterated in the order they were specified.import static manifold.rt.api.util.Pair.and; Map<String, Integer> scores = mapOf("Moe" and 100, "Larry" and 107, "Curly" and 111);- Parameters:
entries- key/value pairs, for use with thekey and valuebinding expression syntax viaPair.and.- Returns:
- a new read-only, ordered map with the specified contents.
- Throws:
UnsupportedOperationException- if the put operation is not supported by this mapClassCastException- if the class of the specified key or value prevents it from being stored in this mapNullPointerException- if the specified key or value is null and this map does not permit null keys or valuesIllegalArgumentException- if some property of the specified key or value prevents it from being stored in this map- See Also:
Map.put(Object, Object)
-
-