public Builder<V> addAll(Collection<V> add) { if (auto && add instanceof SortedSet && equalComparators(comparator, ((SortedSet) add).comparator())) { // if we're a SortedSet, permit quick order-preserving addition of items // if we collect all duplicates, don't bother as merge will necessarily be more expensive than sorting at end return mergeAll(add, add.size()); } detected = false; if (values.length < count + add.size()) values = Arrays.copyOf(values, max(count + add.size(), count * 2)); for (V v : add) values[count++] = v; return this; }
public Builder<V> addAll(Collection<V> add) { if (auto && add instanceof SortedSet && equalComparators(comparator, ((SortedSet) add).comparator())) { // if we're a SortedSet, permit quick order-preserving addition of items // if we collect all duplicates, don't bother as merge will necessarily be more expensive than sorting at end return mergeAll(add, add.size()); } detected = false; if (values.length < count + add.size()) values = Arrays.copyOf(values, max(count + add.size(), count * 2)); for (V v : add) values[count++] = v; return this; }
public Builder<V> addAll(Collection<V> add) { if (auto && add instanceof SortedSet && equalComparators(comparator, ((SortedSet) add).comparator())) { // if we're a SortedSet, permit quick order-preserving addition of items // if we collect all duplicates, don't bother as merge will necessarily be more expensive than sorting at end return mergeAll(add, add.size()); } detected = false; if (values.length < count + add.size()) values = Arrays.copyOf(values, max(count + add.size(), count * 2)); for (V v : add) values[count++] = v; return this; }
public Builder<V> addAll(Collection<V> add) { if (auto && add instanceof SortedSet && equalComparators(comparator, ((SortedSet) add).comparator())) { // if we're a SortedSet, permit quick order-preserving addition of items // if we collect all duplicates, don't bother as merge will necessarily be more expensive than sorting at end return mergeAll(add, add.size()); } detected = false; if (values.length < count + add.size()) values = Arrays.copyOf(values, max(count + add.size(), count * 2)); for (V v : add) values[count++] = v; return this; }