Project

Profile

Help

Revision 7f6b115d

Added by O'Neil Delpratt 8 months ago

Bug fix relating to issue #4890

View differences:

src/main/java/net/sf/saxon/dotnet/DotNetIterator.java
24 24

  
25 25
    private final IEnumerator enumerator;
26 26
    private Mapper<T> mapper;
27
    private boolean moreToCome;
27 28

  
28 29

  
29 30
    public DotNetIterator() {
30 31
        this.enumerator = null;
32
        moreToCome = false;
31 33
    }
32 34

  
33 35
    public DotNetIterator(IEnumerator enumerator) {
34 36
        this.enumerator = enumerator;
37
        this.moreToCome = enumerator.MoveNext();
35 38
    }
36 39

  
37 40
    public DotNetIterator(IEnumerator enumerator, Mapper<T> mapper) {
38 41
        this.enumerator = enumerator;
39 42
        this.mapper = mapper;
43
        this.moreToCome = enumerator.MoveNext();
40 44
    }
41 45

  
42 46
    @Override
43 47
    public boolean hasNext() {
44
        return enumerator.MoveNext();
48
        return moreToCome;
45 49
    }
46 50

  
47 51
    @Override
48 52
    public T next() {
49 53
        Object o = enumerator.get_Current();
54
        this.moreToCome = enumerator.MoveNext();
50 55
        if (mapper != null) {
51 56
            return mapper.convert(o);
52 57
        } else {

Also available in: Unified diff