public ListNode mergeKLists(ListNode[] lists)
	{
		if (lists.length == 0)
			return null;
			
		NavigableSet<ListNode> priorityQueue = new TreeSet<ListNode>(
			new ListNodeComparator());

		for (ListNode node : lists) {
			if (node == null)
				continue;
			priorityQueue.add(node);
		}
		
		if (priorityQueue.isEmpty())
			return null;
			
		ListNode result = priorityQueue.pollFirst();
		ListNode current = result;
		
		if (result.next != null) {
			priorityQueue.add(result.next);
		}
		
		while (!priorityQueue.isEmpty()) {
			ListNode smallest = priorityQueue.pollFirst();
			if (smallest.next != null) {
				priorityQueue.add(smallest.next);
			}
			current.next = smallest;
			current = smallest;
		}
		return result;
	}