org.springframework.data.util

## 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 Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `equals(Object o)`
`S` `getFirst()` Returns the first element of the `Pair`.
`T` `getSecond()` Returns the second element of the `Pair`.
`int` `hashCode()`
`static <S,T> Pair<S,T>` `of(S first, T second)` Creates a new `Pair` for the given elements.
`static <S,T> Collector<Pair<S,T>,?,Map<S,T>>` `toMap()` A collector to create a `Map` from a `Stream` of `Pair`s.
`String` `toString()`

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

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

### Method Detail

#### 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 `Pair`s.

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`