Class IndexListsIterator

java.lang.Object
org.apache.jena.util.iterator.NiceIterator<Triple>
org.apache.jena.mem.store.indexed.IndexListsIterator
All Implemented Interfaces:
Iterator<Triple>, org.apache.jena.atlas.iterator.IteratorCloseable<Triple>, org.apache.jena.atlas.lib.Closeable, ClosableIterator<Triple>, ExtendedIterator<Triple>

public class IndexListsIterator extends NiceIterator<Triple>
Iterator over the intersection of two IndexLists, used by the eager indexing strategy to answer two-key patterns (e.g. subject-and-predicate or predicate-and-object).

The intersection is computed lazily: the iterator walks the shorter of the two lists and probes each candidate triple index against the larger list's reverse-index array. This gives expected O(min(|A|, |B|)) cost without any explicit set-allocation.

Detects concurrent modifications by snapshotting triples.size() at construction time and rechecking it on each call to next() / forEachRemaining(Consumer); throws ConcurrentModificationException if the size has changed.

  • Constructor Details

    • IndexListsIterator

      public IndexListsIterator(IndexedTripleSource source, IndexList indexListA, int[] reverseIndicesA, IndexList indexListB, int[] reverseIndicesB)
      Creates an iterator over the triples whose indices appear in both indexListA and indexListB.
      Parameters:
      source - the canonical triple set to dereference indices against
      indexListA - one of the index lists to intersect
      reverseIndicesA - reverse-index array for indexListA
      indexListB - the other index list to intersect
      reverseIndicesB - reverse-index array for indexListB
  • Method Details