@Override
  public boolean retainAll(Collection collection) {
    boolean changed = false;
    int size = size();

    Iterator it = iterator();
    while (it.hasNext()) {
      Object object = it.next();
      if (!collection.contains(object)) {
        it.remove();
        changed = true;
      }
    }
    return changed;
  }
Removes any values in the set which are not contained in <tt>collection</tt>.

@param collection a <code>Collection</code> value
@return true if the set was modified by the retain all operation
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/HashIndexSet.java