CircularFifoQueue

CircularFifoQueue is a first-in first-out queue with a fixed size that replaces its oldest element if full.

The removal order of a CircularFifoQueue is based on the insertion order; elements are removed in the same order in which they were added. The iteration order is the same as the removal order.

The add, remove, peek, poll, offer operations all perform in constant time. All other operations perform in linear time or worse.

This queue prevents null objects from being added.

Since

4.0

Parameters

<E>

the type of elements in this collection

Constructors

Link copied to clipboard
constructor()
Constructor that creates a queue with the default size of 32.
constructor(coll: Collection<out E>)
Constructor that creates a queue from the specified collection.
constructor(size: Int)
Constructor that creates a queue with the specified size.

Functions

Link copied to clipboard
open fun add(element: E): Boolean
Adds the given element to this queue.
Link copied to clipboard
open fun addAll(c: Collection<out E>): Boolean
Link copied to clipboard
open fun clear()
Clears this queue.
Link copied to clipboard
open fun contains(o: Any): Boolean
Link copied to clipboard
open fun containsAll(c: Collection<out Any>): Boolean
Link copied to clipboard
open fun element(): E
Link copied to clipboard
open fun forEach(action: Consumer<in T>)
Link copied to clipboard
open fun get(index: Int): E
Returns the element at the specified position in this queue.
Link copied to clipboard
Returns true if the capacity limit of this queue has been reached, i.e.
Link copied to clipboard
open fun isEmpty(): Boolean
Returns true if this queue is empty; false otherwise.
Link copied to clipboard
open fun isFull(): Boolean
A CircularFifoQueue can never be full, thus this returns always false.
Link copied to clipboard
open fun iterator(): Iterator<E>
Returns an iterator over this queue's elements.
abstract fun iterator(): Iterator<T>
Link copied to clipboard
open fun maxSize(): Int
Gets the maximum size of the collection (the bound).
Link copied to clipboard
open fun offer(element: E): Boolean
Adds the given element to this queue.
Link copied to clipboard
open fun parallelStream(): Stream<E>
Link copied to clipboard
open fun peek(): E
Link copied to clipboard
open fun poll(): E
Link copied to clipboard
open fun remove(): E
open fun remove(o: Any): Boolean
Link copied to clipboard
open fun removeAll(c: Collection<out Any>): Boolean
Link copied to clipboard
open fun removeIf(filter: Predicate<in E>): Boolean
Link copied to clipboard
open fun retainAll(c: Collection<out Any>): Boolean
Link copied to clipboard
open fun size(): Int
Returns the number of elements stored in the queue.
Link copied to clipboard
Link copied to clipboard
open fun stream(): Stream<E>
Link copied to clipboard
open fun toArray(): Array<Any>
open fun <T> toArray(a: Array<T>): Array<T>
Link copied to clipboard
open fun toString(): String