mapToArray

inline fun <T, R> Array<T>.mapToArray(transform: (T) -> R): Array<R>

Perform the given transform on every element in this array, and return a new array with the results.

Equivalent to this.map { transform(it) }.toTypedArray(), but saves on the creation of an intermediate list.


inline fun <T, R> Collection<T>.mapToArray(transform: (T) -> R): Array<R>
inline fun <T, R> ArrayList<T>.mapToArray(transform: (T) -> R): Array<R>

Perform the given transform on every element in this list, and return a new array with the results.

Equivalent to this.map { transform(it) }.toTypedArray(), but saves on the creation of an intermediate list.


inline fun <K, V, R> Map<K, V>.mapToArray(transform: (Map.Entry<K, V>) -> R): Array<R>

Perform the given transform on every element in this map, and return a new array with the results.

Equivalent to this.map { transform(it) }.toTypedArray(), but saves on the creation of an intermediate list.