T
- item typepublic class ResettableSingletonTraverser<T> extends Object implements Traverser<T>, Consumer<T>
Consumer<T>
. Another item can be set at any
time and the subsequent next()
call will consume it. However,
if this traverser already has an item, it is illegal to set another one
before consuming it.
See AppendableTraverser
if you have more items to traverse.
Constructor and Description |
---|
ResettableSingletonTraverser() |
Modifier and Type | Method and Description |
---|---|
void |
accept(T item)
Resets this traverser so that the following
next() call will
return the item supplied here. |
T |
next()
Returns the next item, removing it from this traverser.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public T next()
Traverser
null
. If this traverser is null-terminated,
getting a null
means it's exhausted and will keep returning
null
forever. Otherwise, trying again later may produce one.Copyright © 2022 Hazelcast, Inc.. All rights reserved.