Package-level declarations

Types

Link copied to clipboard
open class BaseException(val message: String)
Link copied to clipboard

Shape of a moving window operation to be returned.

Link copied to clipboard
data class NoSuchElementException(val elementName: String) : BaseException
Link copied to clipboard
open class Property<T>(value: T, isDefault: Boolean = false)

Read-only property of type T with context information, whether the property contains a default value. Usable as property delegate.

Link copied to clipboard
class SettableProperty<T>(value: T, isDefault: Boolean = false) : Property<T>

Mutable property usable as property delegate.

Functions

Link copied to clipboard
inline fun <T> Iterable<T>.anyWithNext(crossinline predicate: (a: T, b: T) -> Boolean): Boolean

Returns true, if at least one consecutively following pair matches the predicate.

Link copied to clipboard
inline fun <T> Iterable<T>.anyWithNextEnclosing(crossinline predicate: (a: T, b: T) -> Boolean): Boolean

Returns true, if at least one consecutively following pair (including the enclosing pair) matches the predicate.

Link copied to clipboard
fun <T> Set<T>.combinations(size: Int): Set<Set<T>>

Returns all possible subsets of this with size.

Link copied to clipboard
@JvmName(name = "cumulativeSumOfDouble")
fun Iterable<Double>.cumulativeSum(): List<Double>
@JvmName(name = "cumulativeSumOfFloat")
fun Iterable<Float>.cumulativeSum(): List<Float>
@JvmName(name = "cumulativeSumOfInt")
fun Iterable<Int>.cumulativeSum(): List<Int>

Returns the cumulative sum.

Link copied to clipboard
inline fun <T, K> Iterable<T>.distinctConsecutiveBy(crossinline selector: (T) -> K): List<T>

Returns a list without consecutive elements which have the same return by the given selector function.

Link copied to clipboard
inline fun <T, K> Iterable<T>.distinctConsecutiveEnclosingBy(crossinline selector: (T) -> K): List<T>

Returns a list without consecutive elements which have the same return by the given selector function. The operation is performed enclosing around the list, meaning that the selector(lastElement) == selector(firstElement) is also evaluated.

Link copied to clipboard
inline fun <T> Iterable<T>.filterToSorting(predicate: (first: T, second: T) -> Boolean): List<T>

Returns a sorted list according to the predicate by filtering all unsorted elements.

Link copied to clipboard
inline fun <T, K : Comparable<K>> Iterable<T>.filterToSortingBy(crossinline selector: (T) -> K): List<T>

Returns a list sorted according to natural sort order of the value returned by specified selector function by filtering all unsorted elements.

Link copied to clipboard
inline fun <T, K : Comparable<K>> Iterable<T>.filterToStrictSortingBy(crossinline selector: (T) -> K): List<T>

Returns a list strictly sorted according to natural sort order of the value returned by specified selector function by filtering all unsorted elements.

Link copied to clipboard
inline fun <T, K : Comparable<K>> Iterable<T>.filterToStrictSortingByDescending(crossinline selector: (T) -> K): List<T>

Returns a list sorted descending according to natural sort order of the value returned by specified selector function by filtering all unsorted elements.

Link copied to clipboard
fun <T> List<T>.filterWindowed(dropIndices: List<Boolean>, predicate: (List<T>) -> Boolean): List<T>

Returns a list containing all elements not matching the given predicate. The predicate is operated on a sublist and if the pattern matches the elements with indices dropIndices are dropped.

Link copied to clipboard
fun <T> List<T>.filterWindowedEnclosing(windowSize: Int, predicate: (List<T>) -> Boolean): List<T>

Filters out all elements, when the predicate with windowSize is matching.

fun <T> List<T>.filterWindowedEnclosing(dropIndices: List<Boolean>, predicate: (List<T>) -> Boolean): List<T>

Filter windows that follow which match the predicate. The filter window is executed enclosing the list.

Link copied to clipboard
inline fun <T> Iterable<T>.filterWithNext(crossinline predicate: (a: T, b: T) -> Boolean): List<T>

Returns a list containing only elements where the pair of it and its successor matches the given predicate. The last element is always included.

Link copied to clipboard
inline fun <T> Iterable<T>.filterWithNextEnclosing(crossinline predicate: (a: T, b: T) -> Boolean): List<T>

Returns a list containing only elements where the pair of it and its successor (including the enclosing pair) matches the given predicate.

Link copied to clipboard
fun <V> List<V>.getValueEither(index: Int): Either<NoSuchElementException, V>

Returns the value of listindex as Either.Right, if it exists, or as Either.Left otherwise.

fun <K : Any, V> Map<K, V>.getValueEither(key: K): Either<NoSuchElementException, V>

Returns the value of mapkey as Either.Right, if it exists, or as Either.Left otherwise.

Link copied to clipboard
inline fun <V> Option<V>.handleEmpty(block: (Option<V>) -> Nothing): V

Handle the None of Option with block and return the V.

Link copied to clipboard
inline fun <A, B> Iterable<Either<A, B>>.handleLeftAndFilter(block: (Either.Left<A>) -> Unit): List<B>

Handle all Either.Left with block and return only the values of Either.Right.

Link copied to clipboard
fun <T, K> Collection<T>.hasSameSizeAs(vararg others: Collection<K>): Boolean

Returns true, if all lists have the same number of elements.

Link copied to clipboard

Returns true, if list is sorted in weak ascending order.

Link copied to clipboard
inline fun <T, R : Comparable<R>> Iterable<T>.isSortedBy(crossinline selector: (T) -> R): Boolean

Returns true, if the list is sorted ascending according to the selector.

Link copied to clipboard

Returns true, if list is sorted in weak descending order.

Link copied to clipboard

Returns true, if list is sorted in strict ascending order.

Link copied to clipboard
inline fun <T, R : Comparable<R>> Iterable<T>.isStrictlySortedBy(crossinline selector: (T) -> R): Boolean

Returns true, if the list is strictly sorted ascending according to the selector.

Link copied to clipboard

Returns true, if list is sorted in strict descending order.

Link copied to clipboard
fun List<Boolean>.moveWindow(window: List<Boolean>, shape: MovingWindowShape = MovingWindowShape.FULL): List<Boolean>

Moving a window over a Boolean list with boolean window.

fun <S, T, K> List<S>.moveWindow(window: List<T>, multiplication: (baseElement: S, otherElement: T) -> K, addition: (K, K) -> K, shape: MovingWindowShape = MovingWindowShape.FULL): List<K>

Returns a list, over which window was moved/ slided over. This function is an abstract implementation of the moving average, but it can also be used to realize boolean window filters.

Link copied to clipboard
inline fun <T> Iterable<T>.noneWithNext(crossinline predicate: (a: T, b: T) -> Boolean): Boolean

Returns true, if no consecutively following pair matches the predicate.

Link copied to clipboard
inline fun <T> Iterable<T>.noneWithNextEnclosing(crossinline predicate: (a: T, b: T) -> Boolean): Boolean

Returns true, if no consecutively following pair (including the enclosing pair) matches the predicate.

Link copied to clipboard
fun <T> Set<T>.powerSet(): Set<Set<T>>

Returns the set of all possible subsets. See wikipedia article of power set.

Link copied to clipboard
Link copied to clipboard
fun <T> Sequence<T>.windowedEnclosing(size: Int, step: Int = 1): Sequence<List<T>>

Creates a sequence of lists with size, iterating through the (receiver) sequence.

Link copied to clipboard
fun <T, R, S> Iterable<T>.zip(otherA: Iterable<R>, otherB: Iterable<S>): List<Triple<T, R, S>>

Returns a list of triples built from the elements of this collection and the otherA as well as otherB array with the same index. The returned list has length of the shortest collection.

fun <T, R, S, V> Iterable<T>.zip(otherA: Iterable<R>, otherB: Iterable<S>, transform: (a: T, b: R, c: S) -> V): List<V>

Returns a list of values built from this collection and the otherA as well as otherB array with the same index. For combining the arrays the transform function is applied.

Link copied to clipboard
fun <T, K> Iterable<T>.zipWithConsecutives(keySelector: (T) -> K): List<List<T>>

Zips consecutive elements of the original list by the key returned by the given keySelector function applied to each element and returns a list where each containing list holds the selected elements.

Link copied to clipboard
fun <T, K> Iterable<T>.zipWithConsecutivesEnclosing(keySelector: (T) -> K): List<List<T>>

Zips consecutive elements of the original list by the key returned by the given keySelector function applied to each element and returns a list where each containing list holds the selected elements. If last zip and first zip have the same key, the last zip is prepended.

Link copied to clipboard

Returns a list of pairs for each two adjacent elements in this collection including a pair of the last and first element.

Link copied to clipboard

Zip each element in this list with the next two elements and zip them to a Triple.