Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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();
 }