- Type Parameters:
K
- the type of the keys in the mapV
- the type of the values in the map
- All Superinterfaces:
JenaMapSetCommon<K>
- All Known Implementing Classes:
FastHashedBunchMap
,FastHashMap
,HashCommonMap
,HashedBunchMap
A map from keys of type
K
to values of type V
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
compute
(K key, UnaryOperator<V> valueProcessor) Compute a value for a key.computeIfAbsent
(K key, Supplier<V> absentValueSupplier) Compute a value for a key if the key is not present.Get the value associated with the provided key.getOrDefault
(K key, V defaultValue) Get the value associated with the provided key, or a default value if the key is not present.void
Put a key-value pair into the map.boolean
Try to put a key-value pair into the map.Get an iterator over the values in the map.Get a spliterator over the values in the map.Get a stream over the values in the map.Get a parallel stream over the values in the map.Methods inherited from interface org.apache.jena.mem2.collection.JenaMapSetCommon
anyMatch, clear, containsKey, isEmpty, keyIterator, keySpliterator, keyStream, keyStreamParallel, removeUnchecked, size, tryRemove
-
Method Details
-
tryPut
Try to put a key-value pair into the map. If the key is already present, the value is updated.- Parameters:
key
- the key to putvalue
- the value to put- Returns:
- true if the key-value pair was put into the map, false if the key was already present
-
put
Put a key-value pair into the map. If the key is already present, the value is updated.- Parameters:
key
- the key to putvalue
- the value to put
-
get
Get the value associated with the provided key.- Parameters:
key
- the key to look up- Returns:
- the value associated with the key, or null if the key is not present
-
getOrDefault
Get the value associated with the provided key, or a default value if the key is not present.- Parameters:
key
- the key to look updefaultValue
- the default value to return if the key is not present- Returns:
- the value associated with the key, or the default value if the key is not present
-
computeIfAbsent
Compute a value for a key if the key is not present. The value is automatically put into the map.- Parameters:
key
- the key whose value is to retrieved or computedabsentValueSupplier
- the function to compute a value for the key, if the key is not present- Returns:
- the value associated with the key, or the value computed by the function if the key is not present
-
compute
Compute a value for a key.- Parameters:
key
- the key to compute a value forvalueProcessor
- the function to compute a value for the key. The function is passed the current value associated with the key, or null if the key is not present. The function should return the new value to associate with the key, or null if the key should be removed from the map.
-
valueIterator
ExtendedIterator<V> valueIterator()Get an iterator over the values in the map.- Returns:
- an iterator over the values in the map
-
valueSpliterator
Spliterator<V> valueSpliterator()Get a spliterator over the values in the map.- Returns:
- a spliterator over the values in the map
-
valueStream
Get a stream over the values in the map.- Returns:
- a stream over the values in the map
-
valueStreamParallel
Get a parallel stream over the values in the map.- Returns:
- a parallel stream over the values in the map
-