@Override public C.Set<T> with(T element, T... elements) { C.Set<T> copy = C.newSet(this); copy.add(element); copy.addAll(C.listOf(elements)); return copy; }
public static <T> Set<T> unionOf(Collection<? extends T> col1, Collection<? extends T> col2, Collection<? extends T> col3, Collection<? extends T> ... otherCols) { Set<T> union = C.newSet(col1); union.addAll(col2); union.addAll(col3); for (Collection<? extends T> col : otherCols) { union.addAll(col); } return C.set(union); }
@Override public C.Set<T> with(T element, T... elements) { C.Set<T> copy = C.newSet(this); copy.add(element); copy.addAll(C.listOf(elements)); return copy; }
@Override public C.Set<T> with(Collection<? extends T> col) { C.Set<T> copy = C.newSet(this); copy.addAll(col); if (isImmutable()) { return ImmutableSet.of(copy); } return copy; }
public static <T> Set<T> unionOf(Collection<? extends T> col1, Collection<? extends T> col2, Collection<? extends T> col3, Collection<? extends T> ... otherCols) { Set<T> union = C.newSet(col1); union.addAll(col2); union.addAll(col3); for (Collection<? extends T> col : otherCols) { union.addAll(col); } return C.set(union); }
@Override public C.Set<T> with(Collection<? extends T> col) { C.Set<T> copy = C.newSet(this); copy.addAll(col); if (isImmutable()) { return ImmutableSet.of(copy); } return copy; }