How to get the first element of a queue in Scala

1 Answer

0 votes
import scala.collection.mutable._

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

        var firstElement = q.front  
        
        printf("%d\n", firstElement)
        print(q.front)
    }
}
     
     
     
     
/*
run:
     
7
7

*/

 



answered Oct 16, 2020 by avibootz

Related questions

1 answer 307 views
1 answer 346 views
346 views asked Oct 16, 2020 by avibootz
1 answer 368 views
368 views asked Oct 16, 2020 by avibootz
1 answer 293 views
1 answer 228 views
...