PriorityQueue> pq = new PriorityQueue>(); for (Character ch : charCounts.keySet()) pq.offer(new HuffmanTreeNode(ch, charCounts.get(ch)));