What would be the best way to set the default size...
# announcements
e
What would be the best way to set the default size for
Iterable
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?
Copy code
inline fun <T, R> Iterable<T>.map(defaultSize: Int = 10, transform: (T) -> R): List<R> {
  return mapTo(ArrayList<R>(collectionSizeOrDefault(defaultSize)), transform)
}