Scala priority queue implementation