private void compareResults(Collection result1, Collection result2, String query,
      boolean checkOrder) {
    Iterator itert1 = result1.iterator();
    Iterator itert2 = result2.iterator();
    int currentIndex = 0;
    while (itert1.hasNext()) {
      Object p1 = itert1.next();
      Object p2 = null;
      if (!checkOrder) {
        if (!collectionContains(result2, p1)) {
          fail("Atleast one element in the pair of SelectResults "
              + "supposedly identical, is not equal " + "Match not found for :" + p1
              + " compared with:" + p2 + "; failed query=" + query + "; element unmatched =" + p1
              + ";p1 class=" + p1.getClass() + " ; other set has =" + result2);
        }
      } else {
        boolean matched = false;
        if (itert2.hasNext()) {
          p2 = itert2.next();
          matched = objectsEqual(p1, p2);
          if (!matched) {
            fail("Order of results was not the same, match not found for :" + p1 + " compared with:"
                + p2 + "; failed query=" + query + "; element unmatched =" + p1 + ";p1 class="
                + p1.getClass() + " compared with " + p2 + ";p2 class=" + p2.getClass()
                + "currentIndex:" + currentIndex + "\nr1:" + result1 + "\n\nr2:" + result2);
          }
        }
      }
      currentIndex++;
    }
  }
Used by these tests:
<ul>
<li>EquiJoinIntegrationTest</li>
<li>IUMRCompositeIteratorJUnitTest</li>
<li>IUMRMultiIndexesMultiRegionJUnitTest</li>
<li>IUMRShuffleIteratorsJUnitTest</li>
<li>IUMRSingleRegionJUnitTest</li>
<li>IndexCreationJUnitTest</li>
<li>IndexHintJUnitTest</li>
<li>IndexMaintainceJUnitTest</li>
<li>IndexUseJUnitTest</li>
<li>IndexedMergeEquiJoinScenariosJUnitTest</li>
<li>MultiRegionIndexUsageJUnitTest</li>
<li>NonDistinctOrderByPartitionedJUnitTest</li>
<li>NonDistinctOrderByReplicatedJUnitTest</li>
<li>NonDistinctOrderByTestImplementation</li>
<li>OrderByPartitionedJUnitTest</li>
<li>OrderByReplicatedJUnitTest</li>
<li>OrderByTestImplementation</li>
<li>QueryIndexUsingXMLDUnitTest</li>
<li>QueryREUpdateInProgressJUnitTest</li>
<li>QueryUsingFunctionContextDUnitTest</li>
<li>QueryUsingPoolDUnitTest</li>
<li>TestNewFunctionSSorRSIntegrationTest</li>
</ul>
Also used by:
<ul>
<li>GroupByTestImpl</li>
<li>PdxGroupByTestImpl</li>
<li>PRQueryDUnitHelper</li>
</ul>
geode-junit/src/main/java/org/apache/geode/cache/query/functional/StructSetOrResultsSet.java