Class TokenObjMap<E>

Type Parameters:
E - generic value type
All Implemented Interfaces:
Iterable<byte[]>

public final class TokenObjMap<E> extends TokenSet
This is an efficient and memory-saving hash map for storing tokens and objects. hash set.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • TokenObjMap

      public TokenObjMap()
      Default constructor.
  • Method Details

    • put

      public void put(byte[] key, E val)
      Indexes the specified key and value. If the key exists, the value is updated.
      Parameters:
      key - key
      val - value
    • computeIfAbsent

      public E computeIfAbsent(byte[] key, Supplier<? extends E> func)
      Returns the value for the specified key. Creates a new value if none exists.
      Parameters:
      key - key
      func - function that create a new value
      Returns:
      value
    • get

      public E get(byte[] key)
      Returns the value for the specified key.
      Parameters:
      key - key to be looked up
      Returns:
      value, or null if nothing was found
    • values

      public Iterable<E> values()
      Returns a value iterator.
      Returns:
      iterator
    • remove

      public int remove(byte[] key)
      Description copied from class: TokenSet
      Removes the entry with the specified key. The deletion of keys will lead to empty entries. If ASet.size is called after deletions, the original number of entries will be returned.
      Overrides:
      remove in class TokenSet
      Parameters:
      key - key
      Returns:
      id of the deleted key, or 0 if the key did not exist
    • clear

      public void clear()
      Description copied from class: ASet
      Resets the data structure.
      Overrides:
      clear in class TokenSet
    • rehash

      protected void rehash(int newSize)
      Description copied from class: ASet
      Rehashes all entries.
      Overrides:
      rehash in class TokenSet
      Parameters:
      newSize - new hash size
    • toString

      public String toString()
      Overrides:
      toString in class TokenSet