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 227 views
1 answer 247 views
247 views asked Oct 16, 2020 by avibootz
1 answer 268 views
268 views asked Oct 16, 2020 by avibootz
1 answer 180 views
1 answer 128 views
...