Kotlin
// Make a deque the hard way!
val deque = Deque<Int>(
initialCapacity = 5,
scaleFactor = 2f,
maxSize = 32
)
// Make a deque the easy way!
val deque = dequeOf(1, 2, 3, 4, 5)
// Pop elements off the front!
require(deque.popFirst() == 1)
// Pop elements off the back!
require(deque.popLast() == 5)
// Peek at elements!
require(deque.peekFirst() == 2)
require(deque.peekLast() == 4)
// Push elements onto the deque
deque.pushFirst(-1)
deque.pushLast(-5)
// Iterate non-destructively!
for (value in deque)
println(value)
// Again!!
deque.peekEach { println(it) }
// In reverse!
deque.peekEach(true) { println(it) }
// Iterate destructively!
deque.popEach { println(it) }
This table contains the last 10 versions, for a full list see versions.adoc.
Version | Docs | Description |
---|---|---|
|
Add |
|
|
Add constructor functions for all types. |
|
|
Add |
|
|
Fix issue with |
|
|
Fix issue with |
|
|
Add |
|
|
Add |
|
|
BREAKING! See version release notes! |
|
|
Add |
|
|
Add UByteDeque |