Saturday 24 August 2013

Scala. Get first element of List

Scala. Get first element of List

Why queue.get() return empy list?
class MyQueue{
var queue=List[Int](3,5,7)
def get(){
this.queue.head
}
}
object QueueOperator {
def main(args: Array[String]) {
val queue=new MyQueue
println(queue.get())
}
}
How i can get first element?

No comments:

Post a Comment