Interface JenaSetHashOptimized<E>

Type Parameters:
E - the element type of the set
All Superinterfaces:
Iterable<E>, JenaMapSetCommon<E>, JenaSet<E>, Sized
All Known Subinterfaces:
FastTripleBunch, JenaSetIndexed<E>
All Known Implementing Classes:
FastArrayBunch, FastHashedTripleBunch, FastHashSet, TripleSet, TripleSet

public interface JenaSetHashOptimized<E> extends JenaSet<E>
Extension of JenaSet that lets callers supply a precomputed hash code.

Attention: any caller-supplied hash code MUST equal E.hashCode(); if it does not, the set will misbehave.

  • Method Details

    • tryAdd

      boolean tryAdd(E key, int hashCode)
      Add an element with the given precomputed hash code if it is not already present.
      Parameters:
      key - the element to add. (null is not allowed)
      hashCode - key.hashCode().
      Returns:
      true if added, false if already present
    • addUnchecked

      void addUnchecked(E key, int hashCode)
      Add an element with the given precomputed hash code without checking whether it is already present. The caller MUST ensure the key is absent.
      Parameters:
      key - the element to add. (null is not allowed)
      hashCode - key.hashCode(). (null is not allowed)
    • tryRemove

      boolean tryRemove(E key, int hashCode)
      Try to remove an element with the given precomputed hash code.
      Parameters:
      key - the element to remove
      hashCode - key.hashCode()
      Returns:
      true if removed, false if it was not present
    • removeUnchecked

      void removeUnchecked(E key, int hashCode)
      Remove an element assumed to be present, with the given precomputed hash code. Behavior is undefined if the element is not in the set.
      Parameters:
      key - the element to remove
      hashCode - key.hashCode()