Package org.sosy_lab.common.collect
Interface PersistentMap<K,V extends @Nullable Object>
-
- Type Parameters:
K
- The type of keys.V
- The type of values.
- All Superinterfaces:
Map<K,V>
- All Known Subinterfaces:
PersistentSortedMap<K,V>
,org.sosy_lab.common.collect.PersistentSortedMapBridge<K,V>
- All Known Implementing Classes:
PathCopyingPersistentTreeMap
@Immutable(containerOf={"K","V"}) public interface PersistentMap<K,V extends @Nullable Object> extends Map<K,V>
Interface for persistent map. A persistent data structure is immutable, but provides cheap copy-and-write operations. Thus all write operations ({putAndCopy(Object, Object)
, {removeAndCopy(Object)
}) will not modify the current instance, but return a new instance instead.All modifying operations inherited from
Map
are not supported and will always throwUnsupportedOperationException
. All collections returned by methods of this interface are also immutable.Instances of this interface are thread-safe as long as published safely.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
clear()
Deprecated.Unsupported operation.V
compute(K pKey, BiFunction<? super K,? super V,? extends V> pRemappingFunction)
Deprecated.Unsupported operation.V
computeIfAbsent(K pKey, Function<? super K,? extends V> pMappingFunction)
Deprecated.Unsupported operation.V
computeIfPresent(K pKey, BiFunction<? super K,? super V,? extends V> pRemappingFunction)
Deprecated.Unsupported operation.PersistentMap<K,V>
empty()
Replacement for {clear()
that returns an empty instance.V
merge(K pKey, V pValue, BiFunction<? super V,? super V,? extends V> pRemappingFunction)
Deprecated.Unsupported operation.V
put(K pKey, V pValue)
Deprecated.Unsupported operation.void
putAll(Map<? extends K,? extends V> pM)
Deprecated.Unsupported operation.PersistentMap<K,V>
putAndCopy(K key, V value)
Replacement for {put(Object, Object)
that returns a fresh instance.V
putIfAbsent(K pKey, V pValue)
Deprecated.Unsupported operation.V
remove(Object pKey)
Deprecated.Unsupported operation.boolean
remove(Object pKey, Object pValue)
Deprecated.Unsupported operation.PersistentMap<K,V>
removeAndCopy(Object key)
Replacement for {remove(Object)
that returns a fresh instance.V
replace(K pKey, V pValue)
Deprecated.Unsupported operation.boolean
replace(K pKey, V pOldValue, V pNewValue)
Deprecated.Unsupported operation.void
replaceAll(BiFunction<? super K,? super V,? extends V> pFunction)
Deprecated.Unsupported operation.-
Methods inherited from interface java.util.Map
containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, size, values
-
-
-
-
Method Detail
-
putAndCopy
@CheckReturnValue PersistentMap<K,V> putAndCopy(@CompatibleWith("K") K key, @CompatibleWith("V") V value)
Replacement for {put(Object, Object)
that returns a fresh instance.
-
removeAndCopy
@CheckReturnValue PersistentMap<K,V> removeAndCopy(@CompatibleWith("K") Object key)
Replacement for {remove(Object)
that returns a fresh instance.
-
empty
@CheckReturnValue PersistentMap<K,V> empty()
Replacement for {clear()
that returns an empty instance.
-
put
@Deprecated V put(K pKey, V pValue)
Deprecated.Unsupported operation.
-
putIfAbsent
@Deprecated V putIfAbsent(K pKey, V pValue)
Deprecated.Unsupported operation.- Specified by:
putIfAbsent
in interfaceMap<K,V extends @Nullable Object>
- Throws:
UnsupportedOperationException
- Always.
-
putAll
@Deprecated void putAll(Map<? extends K,? extends V> pM)
Deprecated.Unsupported operation.
-
remove
@Deprecated V remove(Object pKey)
Deprecated.Unsupported operation.
-
remove
@Deprecated boolean remove(Object pKey, Object pValue)
Deprecated.Unsupported operation.
-
clear
@Deprecated void clear()
Deprecated.Unsupported operation.
-
compute
@Deprecated V compute(K pKey, BiFunction<? super K,? super V,? extends V> pRemappingFunction)
Deprecated.Unsupported operation.
-
computeIfAbsent
@Deprecated V computeIfAbsent(K pKey, Function<? super K,? extends V> pMappingFunction)
Deprecated.Unsupported operation.- Specified by:
computeIfAbsent
in interfaceMap<K,V extends @Nullable Object>
- Throws:
UnsupportedOperationException
- Always.
-
computeIfPresent
@Deprecated V computeIfPresent(K pKey, BiFunction<? super K,? super V,? extends V> pRemappingFunction)
Deprecated.Unsupported operation.- Specified by:
computeIfPresent
in interfaceMap<K,V extends @Nullable Object>
- Throws:
UnsupportedOperationException
- Always.
-
replace
@Deprecated V replace(K pKey, V pValue)
Deprecated.Unsupported operation.
-
replace
@Deprecated boolean replace(K pKey, V pOldValue, V pNewValue)
Deprecated.Unsupported operation.
-
replaceAll
@Deprecated void replaceAll(BiFunction<? super K,? super V,? extends V> pFunction)
Deprecated.Unsupported operation.- Specified by:
replaceAll
in interfaceMap<K,V extends @Nullable Object>
- Throws:
UnsupportedOperationException
- Always.
-
merge
@Deprecated V merge(K pKey, V pValue, BiFunction<? super V,? super V,? extends V> pRemappingFunction)
Deprecated.Unsupported operation.
-
-