R
- a generic defining the type this queue will containpublic class BufferingSpliterator<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 |
---|
BufferingSpliterator()
Instantiate a buffering
Spliterator implementation with a queue capacity of
Integer.MAX_VALUE . |
BufferingSpliterator(Instant deadline)
Instantiate a buffering
Spliterator implementation. |
BufferingSpliterator(Instant deadline,
int bufferCapacity)
Instantiate a buffering
Spliterator implementation. |
BufferingSpliterator(int bufferCapacity)
Instantiate a buffering
Spliterator implementation with the given bufferCapacity for the
underlying buffer. |
Modifier and Type | Method and Description |
---|---|
void |
cancel(Throwable t)
Cancel further element retrieval of this queue.
|
int |
characteristics() |
long |
estimateSize() |
boolean |
put(R object)
Add an element to the queue, if possible.
|
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 BufferingSpliterator(Instant deadline)
Spliterator
implementation. The given deadline
indicates the
instant until which the tryAdvance(Consumer)
method can return a positive result. After the
deadline, tryAdvance(Consumer)
will always return false
.
The queue capacity of the backing queue is Integer.MAX_VALUE
.
deadline
- the timestamp in millis since epoch until when data may be served by this instancepublic BufferingSpliterator()
Spliterator
implementation with a queue capacity of
Integer.MAX_VALUE
.public BufferingSpliterator(Instant deadline, int bufferCapacity)
Spliterator
implementation. The given deadline
indicates the
instant until which the tryAdvance(Consumer)
method can return a positive result. After the
deadline, tryAdvance(Consumer)
will always return false
.
bufferCapacity
defines the capacity of the underlying buffer. Offering operations will block
until space is available on the buffer
deadline
- the timestamp in millis since epoch until when data may be served by this instancebufferCapacity
- The number of items allowed in this buffer before suppliers are blockedpublic BufferingSpliterator(int bufferCapacity)
Spliterator
implementation with the given bufferCapacity
for the
underlying buffer. Offering operations will block until space is available on the bufferbufferCapacity
- The number of items allowed in this buffer before suppliers are blockedpublic 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 boolean put(R object)
object
- an R
to be added to the queuetrue
if the object was accepted, or false
if the spliterator does not accept new
messagesCopyright © 2010–2020. All rights reserved.