@Override
  public Set asSet() {
    if (hasLimitIterator) {
      Set returnSet = null;
      if (base instanceof Set) {
        Iterator itr = base.iterator();
        int j = 0;
        while (itr.hasNext()) {
          itr.next();
          ++j;
          if (j > limit) {
            itr.remove();
          }
        }
        returnSet = (Set) base;
      } else {
        returnSet = new HashSet(this);
      }
      return returnSet;
    } else {
      return base instanceof Set ? (Set) base : new HashSet(base);
    }
  }
no-arg constructor required for DataSerializable
geode-core/src/main/java/org/apache/geode/cache/query/internal/ResultsCollectionWrapper.java