Map
obj = | m.put(key, val) | Creates mapping from key to val . It returns the previous value (or null) associated with the key. |
m.putAll(map2) | Adds all key-value entries from another map, map2. | |
Removing key-value pairs from a map | ||
m.clear() | Removes all elements from a Map | |
obj = | m.remove(key) | Deletes mapping from key to anything. Returns previous value (or null) associated with the key. |
Retrieving information from the map | ||
b = | m.containsKey(key) | Returns true if m contains a key key |
b = | m.containsValue(val) | Returns true if m contains val as one of the values |
obj = | m.get(key) | Returns value corresponding to key , or null if there is no mapping. If null has been stored as a value, use containsKey to see if there is a mapping. |
b = | m.isEmpty() | Returns true if m contains no mappings. |
i = | m.size() | Returns number of mappings in m . |
Retrieving all keys, values, or key-value pairs (necessary for iteration) | ||
set = | m.entrySet() | Returns set of Map.Entry values for all mappings. |
set = | m.keySet() | Returns Set of keys. |
col = | m.values() | Returns a Collection view of the values in m . |
No comments:
Post a Comment