Skip to content

Latest commit

 

History

History
116 lines (87 loc) · 3.15 KB

readme.adoc

File metadata and controls

116 lines (87 loc) · 3.15 KB

K-Deque

k deque docs dokka ff69b4 deque

Pure Kotlin deque implementations.

Import

  implementation("io.k-libs:deque:0.9.0")

Usage

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) }

Version History

This table contains the last 10 versions, for a full list see versions.adoc.

Version Docs Description

v0.9.0

Dokka

Add CharDeque. Add copyOf method to all types.

v0.8.0

Dokka

Add constructor functions for all types.

v0.7.0

Dokka

Add ByteDeque, ShortDeque, IntDeque, LongDeque, UShortDeque, UIntDeque, ULongDeque

v0.6.2

Dokka

Fix issue with trimToSize method not messing with the head position.

v0.6.1

Dokka

Fix issue with copyToArray on Deque instances with a size of 1

v0.6.0

Dokka

Add contentEquals method.

v0.5.0

Dokka

Add trimToSize() method.

v0.4.0

Dokka

BREAKING! See version release notes!

v0.3.0

Dokka

Add toArray() method to deques.

v0.2.0

Dokka

Add UByteDeque