uk.ac.starlink.util

## Class Pair<T>

- java.lang.Object
- - uk.ac.starlink.util.Pair<T>

-     public class Pair<T>
      extends java.lang.Object

  Aggregates two objects of the same type. This utility class does not do anything clever.
  Since:
    12 Sep 2019
  See Also:
    `Bi`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Pair(T item1, T item2)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)`
    `T` | `getItem1()` Returns this pair's first item.
    `T` | `getItem2()` Returns this item's second item.
    `int` | `hashCode()`
    `static <S> Pair<S[]>` | `splitArray(S[] in)` Splits an array into two consituent parts.
    `static <S> Pair<java.util.Collection<S>>` | `splitCollection(java.util.Collection<S> in)` Splits a collection into two constituent parts.
    `java.lang.String` | `toString()`

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

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

- - ### Constructor Detail

    - #### Pair

          public Pair(T item1,
                      T item2)

      Constructor.
      Parameters:
        `item1` - first item
        `item2` - second item

  - ### Method Detail

    - #### getItem1

          public T getItem1()

      Returns this pair's first item.
      Returns:
        item

    - #### getItem2

          public T getItem2()

      Returns this item's second item.
      Returns:
        item

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### splitCollection

          public static <S> Pair<java.util.Collection<S>> splitCollection(java.util.Collection<S> in)

      Splits a collection into two constituent parts.
      Parameters:
        `in` - input collection; unaffected on exit
      Returns:
        pair of non-null collections (currently Lists), each containing about half of the input collection

    - #### splitArray

          public static <S> Pair<S[]> splitArray(S[] in)

      Splits an array into two consituent parts.
      Parameters:
        `in` - input array; unaffected on exit
      Returns:
        pair of non-null arrays, each containing about half of the input array