IntArrayDeque

A specialized array deque for int types, allowing no-autoboxing implementation. This is effectively just the Kotlin stdlib ArrayDeque class copied over and adjusted to work off of the primitive int.

Constructors

Link copied to clipboard
constructor(initialCapacity: Int)

Constructs an empty deque with specified initialCapacity, or throws IllegalArgumentException if initialCapacity is negative.

constructor()

Constructs an empty deque.

constructor(elements: Collection<Int>)

Constructs a deque that contains the same elements as the specified elements collection in the same order.

Properties

Link copied to clipboard
Link copied to clipboard
var size: Int

Functions

Link copied to clipboard
fun add(element: Int): Boolean
fun add(index: Int, element: Int)
Link copied to clipboard
fun addAll(elements: Collection<Int>): Boolean
fun addAll(index: Int, elements: Collection<Int>): Boolean
Link copied to clipboard
fun addFirst(element: Int)

Prepends the specified element to this deque.

Link copied to clipboard
fun addLast(element: Int)

Appends the specified element to this deque.

Link copied to clipboard
fun clear()
Link copied to clipboard
fun contains(element: Int): Boolean
Link copied to clipboard
fun first(): Int

Returns the first element, or throws NoSuchElementException if this deque is empty.

Link copied to clipboard

Returns the first element, or null if this deque is empty.

Link copied to clipboard
fun get(index: Int): Int
Link copied to clipboard
fun indexOf(element: Int): Int
Link copied to clipboard
Link copied to clipboard
inline fun isNotEmpty(): Boolean
Link copied to clipboard
fun last(): Int

Returns the last element, or throws NoSuchElementException if this deque is empty.

Link copied to clipboard
fun lastIndexOf(element: Int): Int
Link copied to clipboard
fun lastOrNull(): Int?

Returns the last element, or null if this deque is empty.

Link copied to clipboard
fun remove(element: Int): Boolean
Link copied to clipboard
fun removeAll(elements: Collection<Int>): Boolean
Link copied to clipboard
fun removeAt(index: Int): Int
Link copied to clipboard

Removes the first element from this deque and returns that removed element, or throws NoSuchElementException if this deque is empty.

Link copied to clipboard

Removes the first element from this deque and returns that removed element, or returns default if this deque is empty.

Link copied to clipboard

Removes the first element from this deque and returns that removed element, or returns null if this deque is empty.

Link copied to clipboard

Removes the last element from this deque and returns that removed element, or throws NoSuchElementException if this deque is empty.

Link copied to clipboard

Removes the last element from this deque and returns that removed element, or returns null if this deque is empty.

Link copied to clipboard
fun retainAll(elements: Collection<Int>): Boolean
Link copied to clipboard
fun set(index: Int, element: Int): Int
Link copied to clipboard