How to add element at the end of queue in Scala

1 Answer

0 votes
import scala.collection.mutable._

object O {
    def main(args: Array[String]): Unit = {
        val q = Queue(6, 8, 0, 1, 4)  

        q.enqueue(10)  
        
        q.foreach((element:Int) => printf("%3d", element))  
    }
}
     
     
     
     
/*
run:
     
  6  8  0  1  4 10

*/

 



answered Oct 16, 2020 by avibootz

Related questions

1 answer 201 views
1 answer 207 views
1 answer 155 views
3 answers 137 views
1 answer 246 views
246 views asked Oct 16, 2020 by avibootz
...