R
- a generic defining the type this queue will containpublic class QueueBackedSpliterator<R> extends Object implements Spliterator<R>
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS,T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
Constructor and Description |
---|
QueueBackedSpliterator(long timeout,
TimeUnit timeUnit)
Instantiate a queue backed
Spliterator implementation. |
Modifier and Type | Method and Description |
---|---|
void |
cancel(Throwable t)
Cancel further element retrieval of this queue.
|
int |
characteristics() |
long |
estimateSize() |
void |
put(R object)
Add an element to the queue.
|
boolean |
tryAdvance(Consumer<? super R> action) |
Spliterator<R> |
trySplit() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
public QueueBackedSpliterator(long timeout, TimeUnit timeUnit)
Spliterator
implementation. The given timeout
combined with the
timeUnit
define for how long the tryAdvance(Consumer)
method can be invoked. After the timeout
has exceeded, tryAdvance(Consumer)
defaults to false
.timeout
- a long
defining the timeout, together with the provided timeUnit
timeUnit
- a TimeUnit
defining the unit of time for the provided timeout
public boolean tryAdvance(Consumer<? super R> action)
tryAdvance
in interface Spliterator<R>
public Spliterator<R> trySplit()
trySplit
in interface Spliterator<R>
public long estimateSize()
estimateSize
in interface Spliterator<R>
public int characteristics()
characteristics
in interface Spliterator<R>
public void put(R object)
object
- an R
to be added to the queueCopyright © 2010–2019. All rights reserved.