Skip to content

k-libs/k-queue

Repository files navigation

K-Queue

GitHub docs dokka brightgreen queue

A pure Kotlin FIFO queue implementation.

Import

build.gradle.kts
  implementation("io.klibs:queue:0.4.0")

Usage

// Create a queue from varargs!
val queue = queueOf(1, 2, 3)

// Create a queue from a collection!
val queue = queueOf(list(1, 2, 3))

// Create a queue the boring way!
val queue = Queue<Int>()

// Get crazy with it!
val queue = Queue<Int>(
  initialCapacity = 16,
  scaleFactor = 2F,
  maxSize = 64
)

// Put stuff into a queue!
queue.append(4)

// Get stuff out!
val nextValue = queue.next()

// Iterate!
for (item in queue)
  println("Another one popped off the queue!")

Version History

Version Documentation Description

v0.4.0

Dokka

Add copyToArray and flushToArray

v0.3.0

Dokka

Breaking minor rewrite, see release notes.

v0.2.0

Dokka

Add clear() method to Queue type.

v0.1.0

Dokka

Initial release.