Package com.skydoves.whatif

Functions

addAllWhatIfNotNull
Link copied to clipboard
inline fun <T : MutableCollection<E>, E> T.addAllWhatIfNotNull(element: Collection<E>?, whatIf: (T) -> Unit): T
An expression for adding an element and invoking whatIf when the element is not null.
inline fun <T : MutableCollection<E>, E> T.addAllWhatIfNotNull(element: Collection<E>?, whatIf: (T) -> Unit, whatIfNot: (T) -> Unit): T
An expression for adding an element and invoking whatIf when the element is not null.
addWhatIfNotNull
Link copied to clipboard
inline fun <T : MutableCollection<E>, E> T.addWhatIfNotNull(element: E?, whatIf: (T) -> Unit): T
An expression for adding an element and invoking whatIf when the element is not null.
inline fun <T : MutableCollection<E>, E> T.addWhatIfNotNull(element: E?, whatIf: (T) -> Unit, whatIfNot: (T) -> Unit): T
An expression for adding an element and invoking whatIf when the element is not null.
removeAllWhatIfNotNull
Link copied to clipboard
inline fun <T : MutableCollection<E>, E> T.removeAllWhatIfNotNull(element: Collection<E>?, whatIf: (T) -> Unit): T
An expression for removing a collection of element and invoking whatIf when the element is not null.
inline fun <T : MutableCollection<E>, E> T.removeAllWhatIfNotNull(element: Collection<E>?, whatIf: (T) -> Unit, whatIfNot: (T) -> Unit): T
An expression for removing an element and invoking whatIf when the element is not null.
removeWhatIfNotNull
Link copied to clipboard
inline fun <T : MutableCollection<E>, E> T.removeWhatIfNotNull(element: E?, whatIf: (T) -> Unit): T
An expression for removing an element and invoking whatIf when the element is not null.
inline fun <T : MutableCollection<E>, E> T.removeWhatIfNotNull(element: E?, whatIf: (T) -> Unit, whatIfNot: (T) -> Unit): T
An expression for removing an element and invoking whatIf when the element is not null.
whatIf
Link copied to clipboard
inline fun Boolean?.whatIf(whatIf: () -> Unit): Boolean?
An expression for invoking whatIf when the target Boolean is not null and true.
inline fun <T> T.whatIf(given: Boolean?, whatIf: T.() -> Unit): T
An expression for invoking whatIf when the given boolean is true.
inline fun <T> T.whatIf(given: () -> Boolean?, whatIfDo: T.() -> Unit): T
An expression for invoking whatIf when the given lambda's return value is true.
inline fun <T> T.whatIf(given: (T) -> Boolean?, whatIf: () -> Unit): T
An expression for invoking whatIf when the given boolean is true.
inline fun Boolean?.whatIf(whatIf: () -> Unit, whatIfNot: () -> Unit): Boolean?
An expression for invoking whatIf when the target object is not null and true.
inline fun <T> T.whatIf(given: Boolean?, whatIf: T.() -> Unit, whatIfNot: T.() -> Unit): T
An expression for invoking whatIf when the given boolean is true.
inline fun <T> T.whatIf(given: () -> Boolean?, whatIfDo: T.() -> Unit, whatIfNot: T.() -> Unit): T
An expression for invoking whatIf when the given lambda's return value is true.
inline fun <T> T.whatIf(given: (T) -> Boolean?, whatIf: () -> Unit, whatIfNot: () -> Unit): T
An expression for invoking whatIf when the given boolean is true.
whatIfAnd
Link copied to clipboard
inline fun Iterable<Boolean?>.whatIfAnd(whatIf: () -> Unit): Iterable<Boolean?>
An expression for operating And operator to a list of the nullable-Boolean.
inline fun Boolean?.whatIfAnd(predicate: Boolean?, whatIf: () -> Unit): Boolean?
An expression for invoking whatIf when the target Boolean is true and the predicate is also true.
inline fun Iterable<Boolean?>.whatIfAnd(whatIf: () -> Unit, whatIfNot: () -> Unit): Iterable<Boolean?>
An expression for operating And operator to a list of the nullable-Boolean.
whatIfElse
Link copied to clipboard
inline fun Boolean?.whatIfElse(whatIf: () -> Unit): Boolean?
An expression for invoking whatIf when the target object is not null and false.
whatIfLet
Link copied to clipboard
inline fun <T, R> T.whatIfLet(given: Boolean?, default: R, whatIf: (T) -> R): R
An expression for invoking whatIf when the given boolean value.
inline fun <T, R> T.whatIfLet(given: Boolean?, whatIf: (T) -> R, whatIfNot: (T) -> R): R
An expression for invoking whatIf when the given boolean value.
whatIfMap
Link copied to clipboard
inline fun <T, R> T.whatIfMap(default: R, whatIf: (T) -> R): R
An expression for invoking whatIf when the T target object is not null.
inline fun <T, R> T.whatIfMap(whatIf: (T) -> R, whatIfNot: (T) -> R): R
An expression for invoking whatIf when the T target object is not null.
inline fun <T, R> T.whatIfMap(given: Boolean?, default: R, whatIf: (T) -> R): R
An expression for invoking whatIf when the given boolean value.
inline fun <T, R> T.whatIfMap(given: Boolean?, whatIf: (T) -> R, whatIfNot: (T) -> R): R
An expression for invoking whatIf when the given boolean value.
whatIfNotNull
Link copied to clipboard
inline fun <T> T?.whatIfNotNull(whatIf: (T) -> Unit): T?
An expression for invoking whatIf when the T target object is not null.
inline fun <T> T?.whatIfNotNull(whatIf: (T) -> Unit, whatIfNot: () -> Unit): T?
An expression for invoking whatIf when the T target object is not null.
whatIfNotNullAs
Link copied to clipboard
inline fun <R> Any?.whatIfNotNullAs(whatIf: (R) -> Unit): Any?
An expression for invoking whatIf when the target object is not null.
inline fun <R> Any?.whatIfNotNullAs(whatIf: (R) -> Unit, whatIfNot: () -> Unit): Any?
An expression for invoking whatIf when the target object is not null.
whatIfNotNullOrEmpty
Link copied to clipboard
inline fun <T> Array<out T>?.whatIfNotNullOrEmpty(whatIf: (Array<out T>) -> Unit): Array<out T>?
An expression for invoking whatIf when the Array is not null and not empty.
inline fun BooleanArray?.whatIfNotNullOrEmpty(whatIf: (BooleanArray) -> Unit): BooleanArray?
An expression for invoking whatIf when the BooleanArray is not null and not empty.
inline fun ByteArray?.whatIfNotNullOrEmpty(whatIf: (ByteArray) -> Unit): ByteArray?
An expression for invoking whatIf when the ByteArray is not null and not empty.
inline fun CharArray?.whatIfNotNullOrEmpty(whatIf: (CharArray) -> Unit): CharArray?
An expression for invoking whatIf when the CharArray is not null and not empty.
inline fun DoubleArray?.whatIfNotNullOrEmpty(whatIf: (DoubleArray) -> Unit): DoubleArray?
An expression for invoking whatIf when the DoubleArray is not null and not empty.
inline fun FloatArray?.whatIfNotNullOrEmpty(whatIf: (FloatArray) -> Unit): FloatArray?
An expression for invoking whatIf when the FloatArray is not null and not empty.
inline fun IntArray?.whatIfNotNullOrEmpty(whatIf: (IntArray) -> Unit): IntArray?
An expression for invoking whatIf when the IntArray is not null and not empty.
inline fun LongArray?.whatIfNotNullOrEmpty(whatIf: (LongArray) -> Unit): LongArray?
An expression for invoking whatIf when the LongArray is not null and not empty.
inline fun ShortArray?.whatIfNotNullOrEmpty(whatIf: (ShortArray) -> Unit): ShortArray?
An expression for invoking whatIf when the ShortArray is not null and not empty.
inline fun String?.whatIfNotNullOrEmpty(whatIf: (String) -> Unit): String?
An expression for invoking whatIf when the String is not null and not empty.
inline fun <T> List<T>?.whatIfNotNullOrEmpty(whatIf: (List<T>) -> Unit): List<T>?
An expression for invoking whatIf when the List is not null and not empty.
inline fun <T, R> Map<T, R>?.whatIfNotNullOrEmpty(whatIf: (Map<T, R>) -> Unit): Map<T, R>?
An expression for invoking whatIf when the Map is not null and not empty.
inline fun <T> Set<T>?.whatIfNotNullOrEmpty(whatIf: (Set<T>) -> Unit): Set<T>?
An expression for invoking whatIf when the Set is not null and not empty.
inline fun <T> Array<out T>?.whatIfNotNullOrEmpty(whatIf: (Array<out T>) -> Unit, whatIfNot: () -> Unit): Array<out T>?
An expression for invoking whatIf when the Array is not null and not empty.
inline fun BooleanArray?.whatIfNotNullOrEmpty(whatIf: (BooleanArray) -> Unit, whatIfNot: () -> Unit): BooleanArray?
An expression for invoking whatIf when the BooleanArray is not null and not empty.
inline fun ByteArray?.whatIfNotNullOrEmpty(whatIf: (ByteArray) -> Unit, whatIfNot: () -> Unit): ByteArray?
An expression for invoking whatIf when the ByteArray is not null and not empty.
inline fun CharArray?.whatIfNotNullOrEmpty(whatIf: (CharArray) -> Unit, whatIfNot: () -> Unit): CharArray?
An expression for invoking whatIf when the CharArray is not null and not empty.
inline fun DoubleArray?.whatIfNotNullOrEmpty(whatIf: (DoubleArray) -> Unit, whatIfNot: () -> Unit): DoubleArray?
An expression for invoking whatIf when the DoubleArray is not null and not empty.
inline fun FloatArray?.whatIfNotNullOrEmpty(whatIf: (FloatArray) -> Unit, whatIfNot: () -> Unit): FloatArray?
An expression for invoking whatIf when the FloatArray is not null and not empty.
inline fun IntArray?.whatIfNotNullOrEmpty(whatIf: (IntArray) -> Unit, whatIfNot: () -> Unit): IntArray?
An expression for invoking whatIf when the IntArray is not null and not empty.
inline fun LongArray?.whatIfNotNullOrEmpty(whatIf: (LongArray) -> Unit, whatIfNot: () -> Unit): LongArray?
An expression for invoking whatIf when the LongArray is not null and not empty.
inline fun ShortArray?.whatIfNotNullOrEmpty(whatIf: (ShortArray) -> Unit, whatIfNot: () -> Unit): ShortArray?
An expression for invoking whatIf when the ShortArray is not null and not empty.
inline fun String?.whatIfNotNullOrEmpty(whatIf: (String) -> Unit, whatIfNot: () -> Unit): String?
An expression for invoking whatIf when the String is not null and not empty.
inline fun <T> List<T>?.whatIfNotNullOrEmpty(whatIf: (List<T>) -> Unit, whatIfNot: () -> Unit): List<T>?
An expression for invoking whatIf when the List is not null and not empty.
inline fun <T, R> Map<T, R>?.whatIfNotNullOrEmpty(whatIf: (Map<T, R>) -> Unit, whatIfNot: () -> Unit): Map<T, R>?
An expression for invoking whatIf when the Map is not null and not empty.
inline fun <T> Set<T>?.whatIfNotNullOrEmpty(whatIf: (Set<T>) -> Unit, whatIfNot: () -> Unit): Set<T>?
An expression for invoking whatIf when the Set is not null and not empty.
whatIfNotNullWith
Link copied to clipboard
inline fun <T, R> T?.whatIfNotNullWith(whatIf: (T) -> R, whatIfNot: (T?) -> R): R
An expression for invoking whatIf when the T target object is not null.
whatIfOr
Link copied to clipboard
inline fun Iterable<Boolean?>.whatIfOr(whatIf: () -> Unit): Iterable<Boolean?>
An expression for operating Or operator to a list of the nullable-Boolean.
inline fun Boolean?.whatIfOr(predicate: Boolean?, whatIf: () -> Unit): Boolean?
An expression for invoking whatIf when the target Boolean is true or the predicate is true.
inline fun Iterable<Boolean?>.whatIfOr(whatIf: () -> Unit, whatIfNot: () -> Unit): Iterable<Boolean?>
An expression for operating Or operator to a list of the nullable-Boolean.