Code example for Iterator

Methods: hasNext, next

0
    public FlatRegion3DIterator(FlatRegion region, Iterator<Vector2D> flatIterator) {
        this.flatIterator = flatIterator;
        this.minY = region.getMinimumY();
        this.maxY = region.getMaximumY();
 
        if (flatIterator.hasNext()) {
            this.next2D = flatIterator.next();
        } else { 
            this.next2D = null;
        } 
        this.nextY = minY;
    } 
 
    public FlatRegion3DIterator(FlatRegion region) {
        this(region, region.asFlatRegion().iterator());
    } 
 
    @Override 
    public boolean hasNext() { 
        return next2D != null;
    }