The maximum number of elements that a queue can hold.
The maximum number of elements that a queue can hold.
that unbounded queues can still implement this interface with capacity =
MAX_INT
.
the number of elements that have ever been taken from the queue.
if you know how much time the queue is alive, you can calculate the rate at which elements are being dequeued.
the number of elements that have ever been added to the queue.
if you know how much time the queue is alive, you can calculate the rate at which elements are being enqueued.
,
that Long
is used here, since Int
will be overflowed really quickly
for busy queues.
A non-blocking enqueue.
A non-blocking enqueue.
whether the enqueue was successful or not.
A non-blocking dequeue.
A non-blocking dequeue.
either an element from the queue, or the default
param.
that if there's no meaningful default for your type, you can always use
poll(null)
. Not the best, but reasonable price to pay for lower heap
churn from not using Option
here.
the current number of elements inside the queue.
that this method can be non-atomic and return the approximate number in a concurrent setting.
A non-blocking enqueue of multiple elements.
A non-blocking dequeue of multiple elements.
A MutableConcurrentQueue interface to use under the hood in ZIO.
The implementation at minimum:
this is declared as
abstract class
sinceinvokevirtual
is slightly cheaper thaninvokeinterface
.