sdk-common / com.tomtom.online.sdk.common.func / FuncUtils

FuncUtils

open class FuncUtils

Utility methods to execute Block functions.

Constructors

<init>

FuncUtils()

Utility methods to execute Block functions.

Functions

apply

open static fun <T : Any!> apply(optional: Optional<out T>, fun: Block<T>): Unit
open static fun <T : Any!> apply(optional: Optional<out T>, fun: Block<T>, otherwise: Runnable): Unit

Run function when optional is not absent.

open static fun <T : Any!> apply(obj: Any, type: Class<T>, fun: Block<T>): Unit

Run function when object is of the specific type.

open static fun <T : Any!> apply(obj: Any, type: Class<T>, fun: Block<T>, otherwise: Runnable): Unit

Run function when object is of the specific type otherwise runnable is run.

first

open static fun <T : Any!> first(iterable: MutableIterable<T>): Optional<T>!

Return first element from iterable when possible. Absent element return when list is empty.

forEach

open static fun <T : Any!> forEach(iterable: MutableIterable<T>, fun: Block<T>): Unit

Iterate iterable and apply function on each item.

forEachIndexed

open static fun <T : Any!> forEachIndexed(iterable: MutableIterable<T>, fun: BlockWithIndex<T>): Unit

Iterate iterable and apply function on each item.

forWeekEach

open static fun <T : Any!> forWeekEach(iterable: MutableIterable<WeakReference<out T>!>, fun: Block<WeakReference<out T>!>): Unit

Iterate iterable and apply function on each item.