Package com.hazelcast.jet.core
Class ResettableSingletonTraverser<T>
java.lang.Object
com.hazelcast.jet.core.ResettableSingletonTraverser<T>
- Type Parameters:
T
- item type
Traverses over a single item which can be set from the outside, by using
this traverser as a
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.
- Since:
- Jet 3.0
-
Constructor Details
-
ResettableSingletonTraverser
public ResettableSingletonTraverser()
-
-
Method Details
-
next
Description copied from interface:Traverser
Returns the next item, removing it from this traverser. If no item is available, returnsnull
. If this traverser is null-terminated, getting anull
means it's exhausted and will keep returningnull
forever. Otherwise, trying again later may produce one. -
accept
Resets this traverser so that the followingnext()
call will return the item supplied here. If the traverser already has an item, it is illegal to call this method until that item is consumed by callingnext()
.
-