public boolean trimToSize(final int n) {
    final int l = HashCommon.nextPowerOfTwo((int) Math.ceil(n / _loadFactor));
    if (hashIndexSetProperties.n <= l) {
      return true;
    }
    try {
      rehash(l);
    } catch (OutOfMemoryError cantDoIt) {
      return false;
    }
    return true;
  }
Compress the backing array if possible
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/HashIndexSet.java