/guava/android/guava/src/com/google/common/collect/ImmutableSet.java
Object[] uniqueElements = shouldTrim( uniques, table.length) ? Arrays.copyOf( elements, uniques) : elements;
Object[] uniqueElements = shouldTrim ( uniques, elements.length ) ? Arrays.copyOf ( elements, uniques ) : elements;
E element = (E) requireNonNull(elements[0]); return new SingletonImmutableSet<E>(element); } else if (chooseTableSize(uniques) < tableSize / 2) { return construct(uniques, elements); } else { @Nullable <extra_id_0> return new RegularImmutableSet<E>(uniqueElements, hashCode, table, mask, uniques); } } private static boolean shouldTrim(int actualUnique, int expectedUnique) { return actualUnique < (expectedUnique >> 1) + (expectedUnique >> 2); }