TreeSet changed to PriorityQueue