fork download
  1. object Main extends App {
  2. def x[T](coll: Iterable[T]) = coll.foreach(println)
  3. def y[T](coll: Iterator[T]) = println(coll.next)
  4.  
  5. x(List(1, 2, 3))
  6. x(Some(1))
  7.  
  8. y(List(1, 2, 3).iterator)
  9. }
Success #stdin #stdout 0.37s 322432KB
stdin
Standard input is empty
stdout
1
2
3
1
1