Update Queue.scala

changed apply method to be more functional style using foldleft