Garden 🌻

List::map

Call f on every item in this list, and return a list of the results.

[1, 2].map(fun(x: Int) { x + 1 }) //-> [2, 3]
Source Codepublic method map<T, U>(this: List<T>, f: Fun<(T), U>): List<U> {
  let items: List<U> = []
  for item in this {
    items = items.append(f(item))
  }

  items
}