I
- E
- public class Striterator<I extends Iterator<E>,E> extends Object implements IStriterator<I,E>
Modifier and Type | Field and Description |
---|---|
protected I |
realSource
Set to the source iterator by the ctor.
|
protected I |
src
Set to the source iterator by the ctor and then replaced each time we
wrap the source iterator with another
IFilter . |
Constructor and Description |
---|
Striterator(Enumeration<E> srcEnum)
Wraps the enumeration as an iterator.
|
Striterator(I src) |
Modifier and Type | Method and Description |
---|---|
IStriterator<I,E> |
addFilter(IFilter<I,?,E> filter)
Stack a filter on the source iterator.
|
IStriterator<I,E> |
addInstanceOfFilter(Class<E> cls)
Visits elements that are instances of the specified class.
|
IStriterator<I,E> |
append(I src)
Appends the given iterator when this iterator is exhausted.
|
void |
close()
Closes the iterator, releasing any associated resources.
|
IStriterator<I,E> |
exclude(Set<E> set)
Exclude elements found in the set.
|
boolean |
hasMoreElements() |
boolean |
hasNext() |
IStriterator<I,E> |
makeUnique() |
IStriterator<I,E> |
map(Object client,
Method method) |
E |
next() |
E |
nextElement() |
void |
remove()
Unsupported operation.
|
protected final I extends Iterator<E> realSource
public Striterator(I src)
src
- The source iterator.public Striterator(Enumeration<E> srcEnum)
srcEnum
- The source enumeration.public IStriterator<I,E> addFilter(IFilter<I,?,E> filter)
IStriterator
public IStriterator<I,E> addInstanceOfFilter(Class<E> cls)
IStriterator
addInstanceOfFilter
in interface IStriterator<I extends Iterator<E>,E>
cls
- The class.public IStriterator<I,E> append(I src)
IStriterator
public IStriterator<I,E> exclude(Set<E> set)
set
- The set of elements to be excluded.public IStriterator<I,E> makeUnique()
public IStriterator<I,E> map(Object client, Method method)
public final void close()
ICloseableIterator
ICloseableIterator.close()
if Iterator.hasNext()
method returns false
to ensure that the iterator is closed
(and its resources release) as soon as it is exhausted.
Note: Implementations that support Iterator.remove()
MUST NOT
eagerly close the iterator when it is exhausted since that would make it
impossible to remove the last visited statement. Instead they MUST wait
for an explicit ICloseableIterator.close()
by the application.
close
in interface ICloseable
close
in interface ICloseableIterator<E>
public final boolean hasMoreElements()
hasMoreElements
in interface Enumeration<E>
public final E nextElement()
nextElement
in interface Enumeration<E>
public void remove()
Extreme care must be taken when implementing striterator patterns that
support removal in order to ensure that the current iterator element is
removed from the iteration source. In the general case, it may not be
possible to implement remove()
for striterator patterns.
When the striterator is also an IChunkedIterator
then
remove()
semantics face an additional difficulty. If the source
iterator is being consumed a chunk
at a time, then remove()
only has the semantics of removing the
last element in the chunk.
remove
in interface Iterator<E>
UnsupportedOperationException
- For the above reasons, remove()
is NOT supported for
chunked striterator patterns and this method will always
throw an UnsupportedOperationException
.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.