Module org.jhotdraw8.icollection
Interface ImmutableMap<K,V>
- Type Parameters:
K- the key typeV- the value type
- All Superinterfaces:
Iterable<Map.Entry<K,,V>> ReadOnlyMap<K,V>
- All Known Subinterfaces:
ImmutableNavigableMap<K,,V> ImmutableSequencedMap<K,,V> ImmutableSortedMap<K,V>
- All Known Implementing Classes:
ChampMap,ChampVectorMap,ImmutableMapFacade,RedBlackMap
An interface to an immutable map; the implementation guarantees that the state
of the map does not change.
An interface to an immutable map provides methods for creating a new immutable map with new, updated or deleted entries, without changing the original immutable map.
-
Method Summary
Modifier and TypeMethodDescriptionclear()Returns a copy of this map that is empty.intmaxSize()Returns the maximal number of entries that this map type can holdReturns a copy of this map that contains all entries of this map with the specified entry added or updated.default ImmutableMap<K, V> Returns a copy of this map that contains all entries of this map with entries from the specified map added or updated.default ImmutableMap<K, V> Returns a copy of this map that contains all entries of this map with entries from the specified map added or updated.default ImmutableMap<K, V> putKeyValues(Object... kv) Returns a copy of this map that contains all entries of this map with entries from the specified map added or updated.Returns a copy of this map that contains all entries of this map with the specified entry removed.default ImmutableMap<K, V> Returns a copy of this map that contains all entries of this map except the entries of the specified collection.default ImmutableMap<K, V> Returns a copy of this map that contains only entries that are in this map and in the specified collection.default ImmutableMap<K, V> retainAll(ReadOnlyCollection<? extends K> c) Returns a copy of this map that contains only entries that are in this map and in the specified collection.Returns a mutable copy of this map.Methods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlyMap
asMap, characteristics, containsEntry, containsKey, containsValue, equals, get, getOrDefault, hashCode, isEmpty, iterator, readOnlyEntrySet, readOnlyKeySet, readOnlyValues, size, spliterator
-
Method Details
-
clear
ImmutableMap<K,V> clear()Returns a copy of this map that is empty.- Returns:
- this set instance if it is already empty, or a different set instance that is empty.
-
put
Returns a copy of this map that contains all entries of this map with the specified entry added or updated.- Parameters:
key- the key of the entryvalue- the value of the entry- Returns:
- this map instance if it already contains the same entry, or a different map instance with the entry added or updated
-
putAll
Returns a copy of this map that contains all entries of this map with entries from the specified map added or updated.- Parameters:
m- another map- Returns:
- this map instance if it already contains the same entries, or a different map instance with the entries added or updated
-
putAll
Returns a copy of this map that contains all entries of this map with entries from the specified map added or updated.- Parameters:
c- another map- Returns:
- this map instance if it already contains the same entries, or a different map instance with the entries added or updated
-
putKeyValues
Returns a copy of this map that contains all entries of this map with entries from the specified map added or updated.- Parameters:
kv- a list of alternating keys and values- Returns:
- this map instance if it already contains the same entries, or a different map instance with the entries added or updated
-
remove
Returns a copy of this map that contains all entries of this map with the specified entry removed.- Parameters:
key- the key of the entry- Returns:
- this map instance if it already does not contain the entry, or a different map instance with the entry removed
-
removeAll
Returns a copy of this map that contains all entries of this map except the entries of the specified collection.- Parameters:
c- a collection with keys of entries to be removed from this map- Returns:
- this map instance if it already does not contain the entries, or a different map instance with the entries removed
-
retainAll
Returns a copy of this map that contains only entries that are in this map and in the specified collection.- Parameters:
c- a collection with keys of entries to be retained in this map- Returns:
- this map instance if it has not changed, or a different map instance with entries removed
-
retainAll
Returns a copy of this map that contains only entries that are in this map and in the specified collection.- Parameters:
c- a collection with keys of entries to be retained in this map- Returns:
- this map instance if it has not changed, or a different map instance with entries removed
-
toMutable
Returns a mutable copy of this map.- Returns:
- a mutable copy.
-
maxSize
int maxSize()Returns the maximal number of entries that this map type can hold- Returns:
- the maximal size
-