- 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 Summary
Modifier and TypeMethodDescriptionbooleananyMatchRandomOrder(Predicate<Triple> predicate) Predicate test that scans elements in hash-table order rather than dense insertion order.booleanisArray()Answertrueiff this bunch is backed by a flat array (i.e. is aFastArrayBunch).Methods inherited from interface org.apache.jena.atlas.lib.Copyable
copyMethods inherited from interface org.apache.jena.mem.collection.JenaMapSetCommon
anyMatch, clear, containsKey, isEmpty, keyIterator, keySpliterator, keyStream, keyStreamParallel, removeUnchecked, tryRemoveMethods inherited from interface org.apache.jena.mem.collection.JenaSet
addUnchecked, forEach, iterator, spliterator, tryAddMethods inherited from interface org.apache.jena.mem.collection.JenaSetHashOptimized
addUnchecked, removeUnchecked, tryAdd, tryRemove
-
Method Details
-
isArray
boolean isArray()Answertrueiff this bunch is backed by a flat array (i.e. is aFastArrayBunch). Exposed as an explicit method so callers can avoidinstanceofchecks on this hot path.- Returns:
trueif this bunch is array-backed
-
anyMatchRandomOrder
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:
trueif any triple in the bunch satisfies the predicate
-