public static ListNode mergeKLists(ArrayList<ListNode> lists) {
		if (lists == null || lists.size() == 0) {
			return null;
		}
		Queue<ListNode> heap = new PriorityQueue<ListNode>(lists.size(), listNodeComparator);
		// add element to heap
		for (int i = 0; i < lists.size(); i++) {
			if (lists.get(i) != null) {
				// put the head of each list into heap
				heap.add(lists.get(i));
			}
		}
		
		ListNode dummy = new ListNode(0);
		ListNode tail = dummy;
		while (!heap.isEmpty()) {
			ListNode head = heap.poll();
			tail.next = head;
			tail = head;
			if (head.next != null) {
				heap.add(head.next);
			}
		}
		return dummy.next;
	}