@Override
  public int compare(Object obj1, Object obj2) {
    if (!(obj1 instanceof SelectResults) || !(obj2 instanceof SelectResults)) {
      Support.assertionFailed("The objects need to be of type SelectResults");
    }
    int answer = -1;
    SelectResults sr1 = (SelectResults) obj1;
    SelectResults sr2 = (SelectResults) obj2;
    int sizeDifference = sr1.size() - sr2.size();
    if (obj1 == obj2) {
      answer = 0;
    } else if (sizeDifference > 0) {
      answer = 1;
    }
    return answer;
  }
Sort the array in ascending order of collection sizes.
geode-core/src/main/java/org/apache/geode/cache/query/internal/SelectResultsComparator.java