eygraber
01/24/2017, 8:15 PMIterable
extension functions like map
where I have an Iterable
that is not a Collection
but I know its size? Is there any chance something like that could get added to the std lib?
inline fun <T, R> Iterable<T>.map(defaultSize: Int = 10, transform: (T) -> R): List<R> {
return mapTo(ArrayList<R>(collectionSizeOrDefault(defaultSize)), transform)
}