Package net.sf.saxon.expr.sort

## Class DocumentOrderIterator

- java.lang.Object
- - net.sf.saxon.expr.sort.DocumentOrderIterator

- All Implemented Interfaces:
    `java.io.Closeable`, `java.lang.AutoCloseable`, `SequenceIterator`

      public final class DocumentOrderIterator
      extends java.lang.Object
      implements SequenceIterator

  DocumentOrderIterator takes as input an iteration of nodes in any order, and returns as output an iteration of the same nodes in document order, eliminating any duplicates. An error occurs if the input sequence contains items that are not nodes.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface net.sf.saxon.om.SequenceIterator

      `SequenceIterator.Property`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DocumentOrderIterator​(SequenceIterator base, ItemOrderComparer comparer)` | Iterate over a sequence in document order.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `NodeInfo` | `next()` | Get the next item in the sequence.

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

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

    - ### Methods inherited from interface net.sf.saxon.om.SequenceIterator

      `close, forEachOrFail, getProperties, materialize`

- - ### Constructor Detail

    - #### DocumentOrderIterator

          public DocumentOrderIterator​(SequenceIterator base,
                                       ItemOrderComparer comparer)
                                throws XPathException

      Iterate over a sequence in document order.
      Parameters:
        `base` - the input sequence to be sorted
        `comparer` - the comparer used for comparing node positions
      Throws:
        `XPathException` - if the input sequence cannot be evaluated, or if it contains an item that is not a node

  - ### Method Detail

    - #### next

          public NodeInfo next()
                        throws XPathException

      Description copied from interface: `SequenceIterator`
      Get the next item in the sequence. This method changes the state of the iterator.
      Specified by:
        `next` in interface `SequenceIterator`
      Returns:
        the next item, or null if there are no more items. Once a call on next() has returned null, no further calls should be made. The preferred action for an iterator if subsequent calls on next() are made is to return null again, and all implementations within Saxon follow this rule.
      Throws:
        `XPathException` - if an error occurs retrieving the next item