Interface FastTripleBunch

All Superinterfaces:
org.apache.jena.atlas.lib.Copyable<FastTripleBunch>, Iterable<Triple>, JenaMapSetCommon<Triple>, JenaSet<Triple>, JenaSetHashOptimized<Triple>, Sized
All Known Implementing Classes:
FastArrayBunch, FastHashedTripleBunch

public interface FastTripleBunch extends JenaSetHashOptimized<Triple>, org.apache.jena.atlas.lib.Copyable<FastTripleBunch>
Set-like container for a "bunch" of triples that share some useful property - typically they all have the same subject, predicate or object, because the bunch is the value of a node-keyed map in a FastTripleStore.

The interface is a stripped-down set with a few extras tuned for the triple-store hot path; concrete implementations are FastArrayBunch (linear scan, used while the bunch is small) and FastHashedTripleBunch (hashed, used once the bunch grows past a threshold).

  • Method Details

    • isArray

      boolean isArray()
      Answer true iff this bunch is backed by a flat array (i.e. is a FastArrayBunch). Exposed as an explicit method so callers can avoid instanceof checks on this hot path.
      Returns:
      true if this bunch is array-backed
    • anyMatchRandomOrder

      boolean anyMatchRandomOrder(Predicate<Triple> predicate)
      Predicate test that scans elements in hash-table order rather than dense insertion order. Tuned for _PO (any-predicate-object) matches.

      JenaMapSetCommon.anyMatch(Predicate) is faster when matches are rare or absent; this method is faster when many matches exist and the dense ordering would force scanning past clustered non-matches before finding a hit. Both variants short-circuit on the first match.

      Parameters:
      predicate - the predicate to test against each triple
      Returns:
      true if any triple in the bunch satisfies the predicate