KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
scala> (1 to 10).iterator.map{_ * 2}.toList res1: List[Int] = List(2, 4, 6, 8, 10, 12, 14, 16, 18, 20) scala> (1 to 10).view.map{_ * 2}.force res2: Seq[Int] = Vector(2, 4, 6, 8, 10, 12, 14, 16, 18, 20) Other than using next,hasNext, when should I choose iterator over view or view over iterator?
Tags (comma-separated)
Save Edits
Cancel