open class FuncUtils
Utility methods to execute Block
functions.
FuncUtils()
Utility methods to execute |
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. |
|
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. |
|
open static fun <T : Any!> forEach(iterable: MutableIterable<T>, fun: Block<T>): Unit
Iterate iterable and apply function on each item. |
|
open static fun <T : Any!> forEachIndexed(iterable: MutableIterable<T>, fun: BlockWithIndex<T>): Unit
Iterate iterable and apply function on each item. |
|
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. |