Class HashCommonBase<E>

java.lang.Object
org.apache.jena.mem.collection.HashCommonBase<E>
Type Parameters:
E - the element type
All Implemented Interfaces:
JenaMapSetCommon<E>, Sized
Direct Known Subclasses:
HashCommonMap, HashCommonSet

public abstract class HashCommonBase<E> extends Object implements JenaMapSetCommon<E>
Common code for hash tables and sets. The hash table is a lookup table. The hash codes are not stored. When the table grows, all hash codes need to be recalculated.
  • Method Details

    • size

      public int size()
      Specified by:
      size in interface Sized
      Returns:
      the number of elements in the collection
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface JenaMapSetCommon<E>
      Returns:
      true if the collection is empty
    • tryRemove

      public boolean tryRemove(E key)
      Remove the object key from this hash's keys if it is present (if it's absent, do nothing).
      Specified by:
      tryRemove in interface JenaMapSetCommon<E>
      Parameters:
      key - the key to remove
      Returns:
      true if the key was removed. If the key was not present, false is returned.
    • removeUnchecked

      public void removeUnchecked(E key)
      Remove the object key from this hash's keys if it is present (if it's absent, do nothing).
      Specified by:
      removeUnchecked in interface JenaMapSetCommon<E>
      Parameters:
      key - the key to remove
    • containsKey

      public boolean containsKey(E key)
      Description copied from interface: JenaMapSetCommon
      Check whether the collection contains a given key.
      Specified by:
      containsKey in interface JenaMapSetCommon<E>
      Parameters:
      key - the key to look for
      Returns:
      true if the collection contains the key
    • anyMatch

      public boolean anyMatch(Predicate<E> predicate)
      Description copied from interface: JenaMapSetCommon
      Check whether the collection contains any element matching the predicate.
      Specified by:
      anyMatch in interface JenaMapSetCommon<E>
      Parameters:
      predicate - the predicate to match
      Returns:
      true if the collection contains any element matching the predicate
    • keyIterator

      public ExtendedIterator<E> keyIterator()
      Description copied from interface: JenaMapSetCommon
      Get an iterator over the keys in the collection.
      Specified by:
      keyIterator in interface JenaMapSetCommon<E>
      Returns:
      an iterator over the keys in the collection
    • keySpliterator

      public Spliterator<E> keySpliterator()
      Description copied from interface: JenaMapSetCommon
      Get a spliterator over the keys in the collection.
      Specified by:
      keySpliterator in interface JenaMapSetCommon<E>
      Returns:
      a spliterator over the keys in the collection