@Override
  public void toData(DataOutput out,
      SerializationContext context) throws IOException {
    // how do we serialize the comparator?
    out.writeInt(size());
    context.getSerializer().writeObject(elementType, out);
    for (final Object o : this) {
      context.getSerializer().writeObject(o, out);
    }
  }
Implementation of SelectResults that extends TreeSet This is the sorted version of ResultSet used
for order by clause If the elements are Structs, then use SortedStructSet instead.

@since GemFire 4.0
geode-core/src/main/java/org/apache/geode/cache/query/internal/SortedResultSet.java