kollection
kollection copied to clipboard
Immutable Collection Libraries and Additional Utilities for Kotlin
kollection
Yet Another Kotlin Collection Library and Additional Utility
Usage
For gradle user
Add the following line to build.gradle:
dependencies {
compile "com.github.kmizu:kollection:0.4"
}
Examples
Collections
KList
KList is a cons-based List. It provides access to head by hd and access to tail by hd. It takes only constant time
to insert a new element to front of the KList. Note that it takes linear time to append a new element to last of the KList
KStream
KStream is like a KList seemingly. But it differs from KList in that KStream's tail is lazily evaluated.
Therefore, KStream can represent an infinite stream. For example, ones is an infinite stream that consists
of only 1 such as the following:
val ones: KStream<Int> = 1 cons { ones }
KOption
KOption is a container which has only one value(Some) or no value(None).
KStack
KStack is cons-based immutable stack implementation.
KListMap
KListMap is KList-based immutable Map.
KListSet
KListMap is KList-based immutable Set.
KTreeSet
KTreeSet is RedBlackTree-based immutable Set.
KTreeMap
KTreeMap is RedBlackTree-based immutable Map.
