public interface IFeatureIterator
IFeatures
.
It is important to note that when done with an IFeatureIterator
that its IFeatureIterator.dispose()
method be called or a
potential resource leak may occur. A typical pattern for using an IFeatureIterator
is as follows:
// this assumes there is an iterator() method returning an IFeatureIterator IFeatureIterator iterator = iterator(); try { while (iterator.hasNext()) { IFeature feature = iterator.next(); // do something with each feature } } finally { iterator.dispose(); }
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of the resources held by this feature iterator.
|
default void |
forEachRemaining(Consumer action)
Performs the given action for each remaining feature in this feature iterator until all features have been
processed or the action throws an exception.
|
boolean |
hasNext()
Returns true if
next will return a feature; false if it will throw an exception. |
boolean |
isDisposed()
Returns true if this feature iterator has been closed; false if not.
|
boolean |
isTransient()
Returns true if this feature iterator will produce transient features; false if not.
|
IFeature |
next()
Returns the next feature from this feature iterator.
|
default void |
remove()
Removes the most recently returned feature from
next . |
IFeature next()
NoSuchElementException
- iteration has no more elements.IllegalStateException
- if this feature iterator has been disposed.void dispose()
ICursor
) to indicate that it may release its
resources. In some cases, such as when the iterator is managing a database cursor,
it is required to release the resources so that the database connection may be reused.
Calling dispose on an iterator that has already been disposed does not throw an exception.boolean isDisposed()
boolean isTransient()
IllegalStateException
- if this feature iterator has been disposed.boolean hasNext()
next
will return a feature; false if it will throw an exception.next
will return a feature; false if it will throw an exception.IllegalStateException
- if this feature iterator has been disposed.default void remove()
next
. This is an optional operation.
The default implementation throws an instance of UnsupportedOperationException
and performs no other action.
UnsupportedOperationException
- if the remove
operation is not supported by this feature iterator.IllegalStateException
- if next()
has not been called or this feature iterator has been disposed.default void forEachRemaining(Consumer action)
The default implementation behaves as if:
try {
while (hasNext()) {
action.accept(next());
}
} finally {
dispose();
}
action
- The action to be performed for each IFeatureNullPointerException
- if the specified action is nullIllegalStateException
- if this feature iterator has been disposed.© 2007, 2022 Precisely. All rights reserved.