Module org.jhotdraw8.icollection
Package org.jhotdraw8.icollection.facade
Class ImmutableMapFacade<K,V>
java.lang.Object
org.jhotdraw8.icollection.readonly.AbstractReadOnlyMap<K,V>
org.jhotdraw8.icollection.facade.ImmutableMapFacade<K,V>
- Type Parameters:
K- the key typeV- the element type
- All Implemented Interfaces:
Iterable<Map.Entry<K,,V>> ImmutableMap<K,,V> ReadOnlyMap<K,V>
Provides a
ImmutableMap facade to a set of ImmutableMap functions.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the spliterator characteristics of the key set.clear()Returns a copy of this map that is empty.booleancontainsKey(@Nullable Object key) Returnstrueif this map contains a entry for the specified key.@Nullable VReturns the value to which the key is mapped, ornullif this map contains no entry for the key.booleanisEmpty()Returnstrueif this map contains no entries.iterator()Returns an iterator over the entries contained in this map.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.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.Returns a copy of this map that contains all entries of this map except the entries of the specified collection.Returns a copy of this map that contains only entries that are in this map and in the specified collection.intsize()Returns the number of entries contained in this map..Returns a mutable copy of this map.Methods inherited from class org.jhotdraw8.icollection.readonly.AbstractReadOnlyMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jhotdraw8.icollection.immutable.ImmutableMap
putAll, putKeyValues, retainAllMethods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlyMap
asMap, containsEntry, containsValue, equals, getOrDefault, hashCode, readOnlyEntrySet, readOnlyKeySet, readOnlyValues, spliterator
-
Constructor Details
-
ImmutableMapFacade
-
-
Method Details
-
clear
Description copied from interface:ImmutableMapReturns a copy of this map that is empty.- Specified by:
clearin interfaceImmutableMap<K,V> - Returns:
- this set instance if it is already empty, or a different set instance that is empty.
-
put
Description copied from interface:ImmutableMapReturns a copy of this map that contains all entries of this map with the specified entry added or updated.- Specified by:
putin interfaceImmutableMap<K,V> - 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
Description copied from interface:ImmutableMapReturns a copy of this map that contains all entries of this map with entries from the specified map added or updated.- Specified by:
putAllin interfaceImmutableMap<K,V> - 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
-
remove
Description copied from interface:ImmutableMapReturns a copy of this map that contains all entries of this map with the specified entry removed.- Specified by:
removein interfaceImmutableMap<K,V> - 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
Description copied from interface:ImmutableMapReturns a copy of this map that contains all entries of this map except the entries of the specified collection.- Specified by:
removeAllin interfaceImmutableMap<K,V> - 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
Description copied from interface:ImmutableMapReturns a copy of this map that contains only entries that are in this map and in the specified collection.- Specified by:
retainAllin interfaceImmutableMap<K,V> - 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
-
isEmpty
public boolean isEmpty()Description copied from interface:ReadOnlyMapReturnstrueif this map contains no entries.- Specified by:
isEmptyin interfaceReadOnlyMap<K,V> - Returns:
trueif empty
-
iterator
Description copied from interface:ReadOnlyMapReturns an iterator over the entries contained in this map. -
maxSize
public int maxSize()Description copied from interface:ImmutableMapReturns the maximal number of entries that this map type can hold- Specified by:
maxSizein interfaceImmutableMap<K,V> - Returns:
- the maximal size
-
size
public int size()Description copied from interface:ReadOnlyMapReturns the number of entries contained in this map..- Specified by:
sizein interfaceReadOnlyMap<K,V> - Returns:
- the number of entries
-
get
Description copied from interface:ReadOnlyMapReturns the value to which the key is mapped, ornullif this map contains no entry for the key.- Specified by:
getin interfaceReadOnlyMap<K,V> - Parameters:
key- a key- Returns:
- the mapped value or
null
-
containsKey
Description copied from interface:ReadOnlyMapReturnstrueif this map contains a entry for the specified key.- Specified by:
containsKeyin interfaceReadOnlyMap<K,V> - Parameters:
key- a key- Returns:
trueif this map contains a entry for the specified key
-
toMutable
Description copied from interface:ImmutableMapReturns a mutable copy of this map.- Specified by:
toMutablein interfaceImmutableMap<K,V> - Returns:
- a mutable copy.
-
characteristics
public int characteristics()Description copied from interface:ReadOnlyMapReturns the spliterator characteristics of the key set.The default implementation in this interface returns
Spliterator.SIZED|Spliterator.DISTINCT.- Specified by:
characteristicsin interfaceReadOnlyMap<K,V> - Returns:
- characteristics.
-