public ImmutableSortedSet<Pair<T, Integer>> zipWithIndex() { Comparator<? super T> comparator = this.comparator(); if (comparator == null) { TreeSortedSet<Pair<T, Integer>> pairs = TreeSortedSet.newSet( Comparators.<Pair<T, Integer>, T>byFunction( Functions.<T>firstOfPair(), Comparators.<T>naturalOrder())); return Iterate.zipWithIndex(this, pairs).toImmutable(); } return Iterate.zipWithIndex( this, TreeSortedSet.<Pair<T, Integer>>newSet(Comparators.<T>byFirstOfPair(comparator))) .toImmutable(); }
public <S> ImmutableSortedSet<Pair<T, S>> zip(Iterable<S> that) { Comparator<? super T> comparator = this.comparator(); if (comparator == null) { TreeSortedSet<Pair<T, S>> pairs = TreeSortedSet.newSet( Comparators.<Pair<T, S>, T>byFunction( Functions.<T>firstOfPair(), Comparators.<T>naturalOrder())); return Iterate.zip(this, that, pairs).toImmutable(); } return Iterate.zip( this, that, TreeSortedSet.<Pair<T, S>>newSet(Comparators.<T>byFirstOfPair(comparator))) .toImmutable(); }
public ImmutableSortedSet<T> newWithout(T element) { if (this.contains(element)) { TreeSortedSet<T> result = TreeSortedSet.newSet(this); result.remove(element); return result.toImmutable(); } return this; }
public ImmutableSortedSet<T> newWithoutAll(Iterable<? extends T> elements) { TreeSortedSet<T> result = TreeSortedSet.newSet(this); this.removeAllFrom(elements, result); return result.toImmutable(); }
public ImmutableSortedSet<T> newWithAll(Iterable<? extends T> elements) { TreeSortedSet<T> result = TreeSortedSet.newSet(this); result.addAllIterable(elements); return result.toImmutable(); }
public ImmutableSortedSet<T> newWith(T element) { if (!this.contains(element)) { return TreeSortedSet.newSet(this).with(element).toImmutable(); } return this; }
public ImmutableSortedSet<T> symmetricDifference(SetIterable<? extends T> setB) { return SetIterables.symmetricDifferenceInto( this, setB, TreeSortedSet.<T>newSet(this.comparator())) .toImmutable(); }
public ImmutableSortedSet<T> difference(SetIterable<? extends T> subtrahendSet) { return SetIterables.differenceInto( this, subtrahendSet, TreeSortedSet.<T>newSet(this.comparator())) .toImmutable(); }
public ImmutableSortedSet<T> intersect(SetIterable<? extends T> set) { return SetIterables.intersectInto(this, set, TreeSortedSet.<T>newSet(this.comparator())) .toImmutable(); }
public ImmutableSortedSet<T> filterNot(Predicate<? super T> predicate) { TreeSortedSet<T> result = TreeSortedSet.newSet(this.comparator()); this.forEach(new FilterNotProcedure<T>(predicate, result)); return result.toImmutable(); }
@Override protected MutableCollection<T> newMutable(int size) { return TreeSortedSet.newSet(this.comparator()); }