![]() The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. values(): Returns a Collection view of the values contained in this map.size(): Returns size of entry objects (number of key-value pairs).replaceAll(BiFunction function): Replace all values with the function output.replace(K key, V oldValue, V newValue): Replace if the oldValue is matched to the existing value in the map for a given key.replace(K key, V value): Replaces the old value with the new value.remove(Object key, Object value): Remove the key if the value is given.remove(Object key): Removes the mapping for the specified key from this map if present.putIfAbsent(K key, V value): If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value.putAll(Map m): Adds all values from another map to the current map.put(K key, V value): Added new value to the map.merge(K k, V v, BiFuction b): If the key exists then it applied the bi function logic and updates the value in the map. ⢠keySet(): Returns Set of keys in the map.isEmpty(): Returns true if this map contains no key-value mappings.get(Object Key): To get the value for a key.forEach(): Forms the given logic on all values in the map. ⢠entrySet(): Returns set with Entry objects.containsValue(Object value): Returns true if this map maps one or more keys to the specified value.containsKey(Object key): Checks the given key is present in the map or not.compute(): This allows to do modifications to values when working with Stream API.clone(): Create a shallow copy of the map but key and values will be not be cloned.clear(): This removes all key/value pairs from map. ![]() If the map structure is modified by the Iterator then it will throw ConcurrentModificationException.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |