Skip to content

05nelsonm/immutable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

092f8da · Feb 26, 2025

History

26 Commits
Dec 31, 2024
Feb 9, 2025
Feb 9, 2025
Feb 9, 2025
Aug 30, 2024
Jan 12, 2024
Feb 9, 2025
Feb 26, 2025
Jan 12, 2024
Feb 26, 2025
Aug 30, 2024
Aug 30, 2024
Feb 26, 2025
Jan 12, 2024
Jan 12, 2024
Jan 12, 2024

Repository files navigation

immutable

badge-license badge-latest-release

badge-kotlin

badge-platform-android badge-platform-jvm badge-platform-js badge-platform-js-node badge-platform-wasm badge-platform-linux badge-platform-macos badge-platform-ios badge-platform-tvos badge-platform-watchos badge-platform-windows badge-support-android-native badge-support-apple-silicon badge-support-js-ir badge-support-linux-arm

Immutability utilities for Kotlin Multiplatform

Immutable Collections

Wrapper classes that implement Set, List, and Map interfaces which inhibit modification via casting.

Does not add any new class references, as all Immutable implementations are private classes.

Top level accessor functions either return the EmptySet, EmptyList, EmptyMap objects, or will copy & wrap the elements with the Immutable class implementation (if not already wrapped).

All collections/iterators returned by Immutable implementation functions are also Immutable.

fun main() {
    immutableSetOf("This", "That")
    immutableListOf("This", "That")
    immutableMapOf("This" to "That")
    
    // toImmutable
    setOf("This", "That").toImmutableSet()
    listOf("This", "That").toImmutableList()
    mapOf("This" to "That").toImmutableMap()
}

Get Started

dependencies {
    implementation("io.matthewnelson.immutable:collections:0.2.0")
}

About

Immutability utilities for Kotlin Multiplatform

Resources

License

Stars

Watchers

Forks

Packages

No packages published