code: private void requirePending() {
  		if (pending != null) {
  			return;
  		}
  
  		long exclusionComparable = Long.MIN_VALUE;
  		while (nInclusionsRemaining != 0 && !queue.isEmpty()) {
  			//find a candidate that is not excluded
  			HeapElement inclusion = null;
  			do {
  				HeapElement candidate = queue.poll();
  				if (candidate.inclusion) {
  					if (exclusionComparable != candidate.comparable()) {
  						inclusion = candidate;
  						break;
  					}
  				} else {
  					exclusionComparable = candidate.comparable();
  				}
  				reattach(candidate);
  				if (nInclusionsRemaining == 0) {
  					return;
  				}
  			} while (!queue.isEmpty());
  			if (inclusion == null) {
  				return;
  			}
  			long inclusionComparable = inclusion.comparable();
  
  			/*
  			 * Check for any following exclusions and for duplicates. We could
  			 * change the sort order so that exclusions always preceded
  			 * inclusions, but that would be less efficient and would make the
  			 * ordering different than the comparable value.
  			 */
  			boolean excluded = exclusionComparable == inclusionComparable;
  			while (!queue.isEmpty() && queue.peek().comparable() == inclusionComparable) {
  				HeapElement match = queue.poll();
  				excluded |= !match.inclusion;
  				reattach(match);
  				if (nInclusionsRemaining == 0) {
  					return;
  				}
  			}
  			if (!excluded) {
  				pending = inclusion;
  				return;
  			}
  			reattach(inclusion);
  		}
  	}
docs: Makes sure that pending contains the next inclusive {@link HeapElement}
  that doesn't match any exclusion, and remove any duplicates of it.