elementAtOrElse

inline fun elementAtOrElse(index: Int, defaultValue: (index: Int) -> Float): Float(source)

Returns the element at the given index or defaultValue if index is out of bounds of the collection.

Parameters

index

The index of the element whose value should be returned

defaultValue

A lambda to call with index as a parameter to return a value at an index not in the list.