Project

Profile

Help

Revision 22e7a890

Added by O'Neil Delpratt over 1 year ago

Add the IteratorWraper class

View differences:

.gitattributes
1124 1124
latest10/hej/net/sf/saxon/om/IgnorableSpaceStrippingRule.java svn_eol_002dstyle=native
1125 1125
latest10/hej/net/sf/saxon/om/Item.java svn_eol_002dstyle=native
1126 1126
latest10/hej/net/sf/saxon/om/ItemConsumer.java svn_eol_002dstyle=native
1127
latest10/hej/net/sf/saxon/om/IteratorWrapper.java svn_eol_002dstyle=native
1127 1128
latest10/hej/net/sf/saxon/om/LargeAttributeMap.java svn_eol_002dstyle=native
1128 1129
latest10/hej/net/sf/saxon/om/LazySequence.java svn_eol_002dstyle=native
1129 1130
latest10/hej/net/sf/saxon/om/MemoSequence.java svn_eol_002dstyle=native
latest10/hej/net/sf/saxon/om/IteratorWrapper.java
1
package net.sf.saxon.om;
2

  
3
import net.sf.saxon.trans.XPathException;
4
import java.util.Iterator;
5

  
6
/**
7
 * Class IteratorWrapper - provides an an SequenceIterator over a Java Iterator.
8
 */
9
public class IteratorWrapper implements SequenceIterator {
10

  
11
    Iterator<? extends Item> iterator;
12

  
13
    /**
14
     * Create a IteratorWrapper backed by an iterator
15
     * @param iterator the iterator that delivers the items in the sequence
16
     */
17

  
18
    public IteratorWrapper(Iterator<? extends Item> iterator) {
19
        this.iterator = iterator;
20
    }
21

  
22

  
23
    /**
24
     * Get the next item in the Iterator
25
     *
26
     * @return the next item in the iterator
27
     */
28
    @Override
29
    public Item next() throws XPathException {
30
        return iterator.next();
31
    }
32
}
33

  
34

  

Also available in: Unified diff