org.eclipse.rdf4j.sail.memory.model

## Class MemStatementIterator<X extends Exception>

- java.lang.Object
- - org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
  - - org.eclipse.rdf4j.common.iteration.LookAheadIteration<MemStatement,X>
    - - org.eclipse.rdf4j.sail.memory.model.MemStatementIterator<X>

- All Implemented Interfaces:
    AutoCloseable, CloseableIteration<MemStatement,X>, Iteration<MemStatement,X>

      public class MemStatementIterator<X extends Exception>
      extends LookAheadIteration<MemStatement,X>

  A StatementIterator that can iterate over a list of Statement objects. This iterator compares Resource and Literal objects using the '==' operator, which is possible thanks to the extensive sharing of these objects in the MemoryStore.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MemStatementIterator(MemStatementList statementList, MemResource subject, MemIRI predicate, MemValue object, Boolean explicit, int snapshot, MemResource... contexts)` Creates a new MemStatementIterator that will iterate over the statements contained in the supplied MemStatementList searching for statements that match the specified pattern of subject, predicate, object and context(s).

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected MemStatement` | `getNextElement()` Searches through statementList, starting from index `_nextStatementIdx + 1`, for statements that match the constraints that have been set for this iterator.

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.LookAheadIteration

      `handleClose, hasNext, next, remove`

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration

      `close, isClosed`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MemStatementIterator

          public MemStatementIterator(MemStatementList statementList,
                                      MemResource subject,
                                      MemIRI predicate,
                                      MemValue object,
                                      Boolean explicit,
                                      int snapshot,
                                      MemResource... contexts)

      Creates a new MemStatementIterator that will iterate over the statements contained in the supplied MemStatementList searching for statements that match the specified pattern of subject, predicate, object and context(s).
      Parameters:
        `statementList` - the statements over which to iterate.
        `subject` - subject of pattern.
        `predicate` - predicate of pattern.
        `object` - object of pattern.
        `contexts` - context(s) of pattern.

  - ### Method Detail

    - #### getNextElement

          protected MemStatement getNextElement()

      Searches through statementList, starting from index `_nextStatementIdx + 1`, for statements that match the constraints that have been set for this iterator. If a matching statement has been found it will be stored in `_nextStatement` and `_nextStatementIdx` points to the index of this statement in `_statementList`. Otherwise, `_nextStatement` will set to `null`.
      Specified by:
        `getNextElement` in class `LookAheadIteration<MemStatement,X extends Exception>`
      Returns:
        The next element, or `null` if no more elements are available.

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.