Contains utility functions for APIs.
interface Group<out T> |
|
interface GroupWithNullableEntries<out T> : Group<T>
Represents a group of T (where |
|
interface GroupWithoutNullableEntries<out T : Any> : Group<T>
Represents a group of T (where |
fun <T> groupsToList(firstGroup: Group<T>, secondGroup: Group<T>, otherGroups: Array<out Group<T>>): List<List<T>>
Adds the given firstGroup, the secondGroup and the otherGroups into a new List and returns it. |
|
fun <T> nullable(t: T): T?
Turns the given type into a nullable type. fun <T> nullable(t: KFunction0<T>): KFunction0<T?> fun <T1, R> nullable(t: KFunction1<T1, R>): KFunction1<T1, R?> fun <T1, T2, R> nullable(t: KFunction2<T1, T2, R>): KFunction2<T1, T2, R?> fun <T1, T2, T3, R> nullable(t: KFunction3<T1, T2, T3, R>): KFunction3<T1, T2, T3, R?> fun <T1, T2, T3, T4, R> nullable(t: KFunction4<T1, T2, T3, T4, R>): KFunction4<T1, T2, T3, T4, R?> fun <T1, T2, T3, T4, T5, R> nullable(t: KFunction5<T1, T2, T3, T4, T5, R>): KFunction5<T1, T2, T3, T4, T5, R?>
Turns the given function reference into a function reference with a nullable return type. |
|
fun <T> nullableContainer(iterable: Iterable<T>): Iterable<T?>
Turns an Iterable into an iterable with a nullable entry type. fun <T> nullableContainer(arr: Array<out T>): Array<out T?>
Turns an Array into an array with a nullable entry type. |
|
fun <K, V : Any> nullableKeyMap(map: Map<out K, V>): Map<out K?, V>
Turns a Map into a map with a nullable key type. |
|
fun <K : Any, V> nullableValueMap(map: Map<K, V>): Map<K, V?>
Turns a Map into a map with a nullable value type. |
|
fun <T : Any> subAssert(assertionCreator: AssertionPlant<T>.() -> Unit): AssertionPlant<T>.() -> Unit
Helper function to circumvent Kotlin inference issues involving lambdas such as: |
|
fun validateAtMost(times: Int, atMostCall: (Int) -> String, atLeastCall: (Int) -> String, exactlyCall: (Int) -> String): Unit
Validates that times is not |
|
fun validateButAtMost(atLeastTimes: Int, butAtMostTimes: Int, atLeastButAtMostCall: (Int, Int) -> String, atLeastCall: (Int) -> String, butAtMostCall: (Int) -> String, exactlyCall: (Int) -> String): Unit
Validates that atLeastTimes is not equal to or greater than butAtMostTimes; throws IllegalArgumentException otherwise, pointing the user to use the given exactlyCall in case atLeastTimes equals butAtMostTimes. |