Heap.equals() implemented to eliminate duplicate result values and
reduce number of evaluation paths.