SimpleList

class SimpleList(list: ImmutableList<KpaElement>) : KpaList(source)

Trivial implementation of KpaList backed by an ImmutableList.

Intended as a reference implementation for testing or for consumers that do not use a specific JSON library.

Parameters

list

The values to expose.

Constructors

Link copied to clipboard
constructor(list: ImmutableList<KpaElement>)

Properties

Link copied to clipboard
open override val factory: KpaElementFactory

The factory that knows how to produce primitives and rebuild structs/lists in this adapter family.

Link copied to clipboard
open override val size: Int

The number of elements in this list.

Functions

Link copied to clipboard
open operator override fun get(index: Int): KpaElement

Returns the element at index. Throws on out-of-range indices.

Link copied to clipboard
operator fun KpaList.get(pointer: KPointer): KpaElement?

Returns the KpaElement at the path identified by pointer, or null if a segment is not a valid index.

Link copied to clipboard

Creates a new KpaList by applying pointer-based mutations within block.

Link copied to clipboard
open override fun toList(): List<KpaElement>

Returns a snapshot of this list as a plain List.