I wonder if there is a standard and short way to convert Sequence to an immutable queue in Scala?
I did not find the magic method in the documentation.
Right now I am doing it like this:
def toQueue[A](s: Seq[A]): Queue[A] = s match { case x +: xs => x +: toQueue(xs) case _ => Queue.empty[A] }
But is there anything more convenient?
collections scala queue
Viacheslav Rodionov
source share