IntList

class IntList(initialCapacity: Int = 16)

Primitive-Int dynamic list. Drop-in replacement for MutableList<Int> in hot loops where boxing each Int to a JVM Integer causes meaningful GC pressure. Used for shape index buffers (outlineElements, topElements, etc.) which can hold thousands of indices and are repopulated on every geometry assemble.

Single-threaded; backing array grows by 50%-or-12 (whichever is larger) on overflow.

Constructors

Link copied to clipboard
constructor(initialCapacity: Int = 16)

Properties

Link copied to clipboard
var size: Int

Functions

Link copied to clipboard
fun add(value: Int)
Link copied to clipboard
fun clear()
Link copied to clipboard
fun copyTo(dst: IntArray, dstOffset: Int): Int

Copies size elements into dst starting at dstOffset; returns dstOffset + size.

Link copied to clipboard
fun copyToReversed(dst: IntArray, dstOffset: Int): Int

Copies elements into dst in reverse order starting at dstOffset; returns dstOffset + size.

Link copied to clipboard
operator fun get(index: Int): Int
Link copied to clipboard
fun removeLast(count: Int)

Drops the trailing count elements without shrinking the backing array.

Link copied to clipboard

Returns a freshly allocated IntArray containing exactly size elements.