I created a queue in which we can perform Enqueue, Dequeue and Traversing in Scala.
class Queue[+A](list:List[A]) {
def enqueue[B>:A](x:B):Queue[B]= new Queue[B](list :+ x)
def dequeue[B>:A]:Queue[B] = new Queue[B](list.tail)
def head = list.head
def tail = list.tail
}
Please review this code and make suggestions.