Garden 🌻

List::enumerate

Return a new list consisting of the items themselves, plus the index of the position of each value.

["a", "b"].enumerate() //-> [(0, "a"), (1, "b")]
Source Codepublic method enumerate<T>(this: List<T>): List<(Int, T)> {
  let items: List<(Int, T)> = []

  let i = 0
  for item in this {
    let t = (i, item)
    items = items.append(t)
    i += 1
  }

  items
}