Top Description Methods
io.reactivex.internal.fuseable

public Interface SimpleQueue<T>

Known Direct Subinterfaces
io.reactivex.internal.operators.maybe.MaybeMergeArray.SimpleQueueWithConsumerIndex, io.reactivex.internal.fuseable.QueueFuseable, io.reactivex.internal.fuseable.SimplePlainQueue
Type Parameters
<T>
the value type to offer and poll, not null
Imports
io.reactivex.annotations.*

A minimalist queue interface without the method bloat of java.util.Collection and java.util.Queue.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Removes all enqueued items from this queue.

public boolean

Returns:

true if the queue is empty
isEmpty
()

Returns true if the queue is empty.

public boolean

Returns:

true if successful, false if the value was not enqueued likely due to reaching the queue capacity)
offer
(T
the value to enqueue, not null
value
)

Atomically enqueue a single.

public boolean

Returns:

true if successful, false if the value was not enqueued likely due to reaching the queue capacity)
offer
(T
the first value to enqueue, not null
v1
,
T
the second value to enqueue, not null
v2
)

Atomically enqueue two values.

public T

Returns:

the item or null to indicate an empty queue
poll
()

Tries to dequeue a value (non-null) or returns null if the queue is empty.

Method Detail

clearback to summary
public void clear()

Removes all enqueued items from this queue.

isEmptyback to summary
public boolean isEmpty()

Returns true if the queue is empty.

Note however that due to potential fused functions in poll() it is possible this method returns false but then poll() returns null because the fused function swallowed the available item(s).

Returns:boolean

true if the queue is empty

offerback to summary
public boolean offer(T value)

Atomically enqueue a single.

Parameters
value:T

the value to enqueue, not null

Returns:boolean

true if successful, false if the value was not enqueued likely due to reaching the queue capacity)

offerback to summary
public boolean offer(T v1, T v2)

Atomically enqueue two values.

Parameters
v1:T

the first value to enqueue, not null

v2:T

the second value to enqueue, not null

Returns:boolean

true if successful, false if the value was not enqueued likely due to reaching the queue capacity)

pollback to summary
public T poll() throws Exception

Tries to dequeue a value (non-null) or returns null if the queue is empty.

If the producer uses offer(Object, Object) and when polling in pairs, if the first poll() returns a non-null item, the second poll() is guaranteed to return a non-null item as well.

Returns:T

the item or null to indicate an empty queue

Annotations
@Nullable
Exceptions
Exception:
if some pre-processing of the dequeued item (usually through fused functions) throws.