Package org.geotools.feature.collection
Class PushBackFeatureIterator<F extends Feature>
- Object
-
- DecoratingFeatureIterator<F>
-
- PushBackFeatureIterator<F>
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,FeatureIterator<F>
public class PushBackFeatureIterator<F extends Feature> extends DecoratingFeatureIterator<F>
A feature iterator allowing to push back one feature
-
-
Field Summary
-
Fields inherited from class DecoratingFeatureIterator
delegate
-
-
Constructor Summary
Constructors Constructor Description PushBackFeatureIterator(FeatureIterator<F> iterator)
Wrap the provided FeatureIterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this iterator and releases any system resources associated with it.boolean
hasNext()
Does another Feature exist in this Iteration.F
next()
Get the next Feature in this iteration.void
pushBack()
Pushes back the last feature returned by next().
-
-
-
Constructor Detail
-
PushBackFeatureIterator
public PushBackFeatureIterator(FeatureIterator<F> iterator)
Wrap the provided FeatureIterator.- Parameters:
iterator
- Iterator to be used as a delegate.
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from interface:FeatureIterator
Does another Feature exist in this Iteration.Iterator defin: Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)
- Specified by:
hasNext
in interfaceFeatureIterator<F extends Feature>
- Overrides:
hasNext
in classDecoratingFeatureIterator<F extends Feature>
- Returns:
- true if more Features exist, false otherwise.
-
next
public F next() throws NoSuchElementException
Description copied from interface:FeatureIterator
Get the next Feature in this iteration.- Specified by:
next
in interfaceFeatureIterator<F extends Feature>
- Overrides:
next
in classDecoratingFeatureIterator<F extends Feature>
- Returns:
- The next Feature
- Throws:
NoSuchElementException
- If no more Features exist.
-
pushBack
public void pushBack()
Pushes back the last feature returned by next(). Will throw anIllegalStateException
if there is no feature to push back. Only a single pushBack call can be performed between two calls to next()
-
close
public void close()
Description copied from interface:FeatureIterator
Closes this iterator and releases any system resources associated with it.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceFeatureIterator<F extends Feature>
- Overrides:
close
in classDecoratingFeatureIterator<F extends Feature>
-
-