Class Pair<S,T>

java.lang.Object
org.springframework.data.util.Pair<S,T>
Type Parameters:
S - Type of the first thing.
T - Type of the second thing.

public final class Pair<S,T> extends Object
A tuple of things.
Since:
1.12
Author:
Tobias Trelle, Oliver Gierke, Christoph Strobl
  • Method Details

    • of

      public static <S, T> Pair<S,T> of(S first, T second)
      Creates a new Pair for the given elements.
      Parameters:
      first - must not be null.
      second - must not be null.
      Returns:
    • getFirst

      public S getFirst()
      Returns the first element of the Pair.
      Returns:
    • getSecond

      public T getSecond()
      Returns the second element of the Pair.
      Returns:
    • toMap

      public static <S, T> Collector<Pair<S,T>,?,Map<S,T>> toMap()
      A collector to create a Map from a Stream of Pairs.
      Returns:
    • equals

      public boolean equals(@Nullable 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