Interface JenaMap<K,V>

Type Parameters:
K - the type of the keys in the map
V - the type of the values in the map
All Superinterfaces:
JenaMapSetCommon<K>
All Known Implementing Classes:
FastHashedBunchMap, FastHashMap, HashCommonMap, HashedBunchMap

public interface JenaMap<K,V> extends JenaMapSetCommon<K>
A map from keys of type K to values of type V.
  • Method Details

    • tryPut

      boolean tryPut(K key, V value)
      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 put
      value - the value to put
      Returns:
      true if the key-value pair was put into the map, false if the key was already present
    • put

      void put(K key, V value)
      Put a key-value pair into the map. If the key is already present, the value is updated.
      Parameters:
      key - the key to put
      value - the value to put
    • get

      V get(K key)
      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

      V getOrDefault(K key, V defaultValue)
      Get the value associated with the provided key, or a default value if the key is not present.
      Parameters:
      key - the key to look up
      defaultValue - 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

      V computeIfAbsent(K key, Supplier<V> absentValueSupplier)
      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 computed
      absentValueSupplier - 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

      void compute(K key, UnaryOperator<V> valueProcessor)
      Compute a value for a key.
      Parameters:
      key - the key to compute a value for
      valueProcessor - 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

      default Stream<V> valueStream()
      Get a stream over the values in the map.
      Returns:
      a stream over the values in the map
    • valueStreamParallel

      default Stream<V> valueStreamParallel()
      Get a parallel stream over the values in the map.
      Returns:
      a parallel stream over the values in the map