Package 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 | 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 Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static CloseableIteration<MemStatement,​SailException>` | `cacheAwareInstance​(MemStatementList smallestList, MemResource subj, MemIRI pred, MemValue obj, Boolean explicit, int snapshot, MemResource[] memContexts, MemStatementIteratorCache iteratorCache)` |
    `boolean` | `equals​(Object o)` |
    `protected MemStatement` | `getNextElement()` | Searches through statementList, starting from index _nextStatementIdx + 1, for statements that match the constraints that have been set for this iterator.
    `org.eclipse.rdf4j.sail.memory.model.MemStatementIterator.Stats` | `getStats()` |
    `protected void` | `handleClose()` | Called by `AbstractCloseableIteration.close()` when it is called for the first time.
    `int` | `hashCode()` |
    `String` | `toString()` |

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

      `hasNext, next, remove`

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

      `close, isClosed`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.common.iteration.Iteration

      `stream`

- - ### 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

    - #### cacheAwareInstance

          public static CloseableIteration<MemStatement,​SailException> cacheAwareInstance​(MemStatementList smallestList,
                                                                                                MemResource subj,
                                                                                                MemIRI pred,
                                                                                                MemValue obj,
                                                                                                Boolean explicit,
                                                                                                int snapshot,
                                                                                                MemResource[] memContexts,
                                                                                                MemStatementIteratorCache iteratorCache)

    - #### 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.

    - #### handleClose

          protected void handleClose()
                              throws X extends Exception

      Description copied from class: `AbstractCloseableIteration`
      Called by `AbstractCloseableIteration.close()` when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.
      Overrides:
        `handleClose` in class `LookAheadIteration<MemStatement,​X extends Exception>`
      Throws:
        `X`
        `X extends Exception`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getStats

          public org.eclipse.rdf4j.sail.memory.model.MemStatementIterator.Stats getStats()