How to call Scala's Queue.enqueue(iter: Iterable[B])?
Tricky, tricky!
I created a ticket about it. You see, you have been misled by types!
scala> q.enqueue(scala.collection.Iterable(4))
res8: scala.collection.immutable.Queue[Any] = Queue(1, 2, 3, List(4))
scala> q.enqueue(scala.collection.immutable.Iterable(4))
res9: scala.collection.immutable.Queue[Int] = Queue(1, 2, 3, 4)
The Iterable
imported by default is the scala.collection.Iterable
, which can be either mutable or immutable, but the immutable queue requires the immutable Iterable
instead.