@Override
  public <K2, V2> ImmutableMap<K2, V2> collect(
      Function2<? super K, ? super V, Pair<K2, V2>> function) {
    Pair<K2, V2> pair1 = function.value(this.key1, this.value1);
    Pair<K2, V2> pair2 = function.value(this.key2, this.value2);
    Pair<K2, V2> pair3 = function.value(this.key3, this.value3);

    return Maps.immutable.of(
        pair1.getOne(),
        pair1.getTwo(),
        pair2.getOne(),
        pair2.getTwo(),
        pair3.getOne(),
        pair3.getTwo());
  }
示例#2
0
 public List<T> valueOf(Pair<T, Counter> each) {
   return Collections.nCopies(each.getTwo().getCount(), each.getOne());
 }
 public int compare(Pair<?, T> p1, Pair<?, T> p2) {
   return this.comparator.compare(p1.getTwo(), p2.getTwo());
 }
 public int compare(Pair<T, ?> p1, Pair<T, ?> p2) {
   return this.comparator.compare(p1.getOne(), p2.getOne());
 }