Scala-way to iterate array-like things