Package com.complexible.common.base

# Class Pair<K1,K2>

java.lang.Object
com.complexible.common.base.Pair<K1,K2>

public final class Pair<K1,K2> extends Object
Tuple with 2 elements

Since:
  2.0
Version:
  2.3
Author:
  Pedro Oliveira, Michael Grove

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final K1`
  `first`
  `final K2`
  `second`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <K1 extends Comparable<K1>, K2 extends Comparable<K2>>
  Comparator<Pair<K1,K2>>`
  `comparator()`
  `static <S, T> Pair<S,T>`
  `create(S a, T b)`
  `static <S, T> Pair<S,T>`
  `createFromFirst(S a, Function<S,T> aToB)`
  `boolean`
  `equals(Object o)`
  `K1`
  `first()`
  `static <K, V> Function<Map.Entry<K,V>,Pair<K,V>>`
  `fromMapEntry()`
  `static <K, V> Pair<K,V>`
  `fromMapEntry(Map.Entry<K,V> e)`
  `int`
  `hashCode()`
  `static <K1_I, K1_O, K2>
  Function<Pair<K1_I,K2>,Pair<K1_O,K2>>`
  `liftOverFirst(Function<K1_I,K1_O> mapper)`
  `static <K1, K2_I, K2_O>
  Function<Pair<K1,K2_I>,Pair<K1,K2_O>>`
  `liftOverSecond(Function<? super K2_I,? extends K2_O> mapper)`
  `static <P1, P2> Consumer<Pair<P1,P2>>`
  `pairBiConsumer(BiConsumer<P1,P2> mapper)`
  `static <P1, P2, R>
  Function<Pair<P1,P2>,R>`
  `pairBiFunction(BiFunction<P1,P2,R> mapper)`
  `static <P1, P2> Predicate<Pair<P1,P2>>`
  `pairBiPredicate(BiPredicate<P1,P2> mapper)`
  `K2`
  `second()`
  `static <K, V> Stream<Pair<K,V>>`
  `streamMap(Map<K,V> m)`
  `static <K1, K2> Collector<Pair<K1,K2>,?,Map<K1,K2>>`
  `toMap()`
  `static <K1, K2> Collector<Pair<K1,K2>,?,Map<K1,K2>>`
  `toMap(Supplier<Map<K1,K2>> mapSupplier)`
  `static <E> Stream<E>`
  `toStream(Pair<E,E> pair)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### first

    public final K1 first

  - ### second

    public final K2 second

- ## Method Details

  - ### create

    public static <S, T> Pair<S,T> create(S a, T b)

  - ### createFromFirst

    public static <S, T> Pair<S,T> createFromFirst(S a, Function<S,T> aToB)

  - ### first

    public K1 first()

  - ### second

    public K2 second()

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### comparator

    public static <K1 extends Comparable<K1>, K2 extends Comparable<K2>> Comparator<Pair<K1,K2>> comparator()

  - ### toMap

    public static <K1, K2> Collector<Pair<K1,K2>,?,Map<K1,K2>> toMap()

  - ### toMap

    public static <K1, K2> Collector<Pair<K1,K2>,?,Map<K1,K2>> toMap(Supplier<Map<K1,K2>> mapSupplier)

  - ### toStream

    public static <E> Stream<E> toStream(Pair<E,E> pair)

  - ### liftOverFirst

    public static <K1_I, K1_O, K2> Function<Pair<K1_I,K2>,Pair<K1_O,K2>> liftOverFirst(Function<K1_I,K1_O> mapper)

  - ### liftOverSecond

    public static <K1, K2_I, K2_O> Function<Pair<K1,K2_I>,Pair<K1,K2_O>> liftOverSecond(Function<? super K2_I,? extends K2_O> mapper)

  - ### pairBiFunction

    public static <P1, P2, R> Function<Pair<P1,P2>,R> pairBiFunction(BiFunction<P1,P2,R> mapper)

  - ### pairBiPredicate

    public static <P1, P2> Predicate<Pair<P1,P2>> pairBiPredicate(BiPredicate<P1,P2> mapper)

  - ### pairBiConsumer

    public static <P1, P2> Consumer<Pair<P1,P2>> pairBiConsumer(BiConsumer<P1,P2> mapper)

  - ### fromMapEntry

    public static <K, V> Function<Map.Entry<K,V>,Pair<K,V>> fromMapEntry()

  - ### fromMapEntry

    public static <K, V> Pair<K,V> fromMapEntry(Map.Entry<K,V> e)

  - ### streamMap

    public static <K, V> Stream<Pair<K,V>> streamMap(Map<K,V> m)