T
- item typepublic class ResettableSingletonTraverser<T> extends Object implements Traverser<T>, java.util.function.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.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 in the sequence, or
null if there is no next
item to return. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append, dropWhile, filter, flatMap, map, onFirstNull, over, peek, prepend, takeWhile
andThen
public T next()
Traverser
null
if there is no next
item to return. If this traverser represents a finite sequence, it will
keep returning null
once exhausted. If it represents an infinite
sequence, null
only means "there is currently no next item", but
trying again later may produce one.public void accept(@Nullable T item)
next()
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 calling
next()
.accept
in interface java.util.function.Consumer<T>
item
- the item to return from next()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.