lv.lumii.layoutengine.util

## Class Pair<T1 extends java.lang.Comparable<? super T1>,T2 extends java.lang.Comparable<? super T2>>

- java.lang.Object
- - lv.lumii.layoutengine.util.Pair<T1,T2>

- Type Parameters:
    `T1` - the type of the first element
    `T2` - the type of the second element
  All Implemented Interfaces:
    java.lang.Comparable<Pair<T1,T2>>

      public class Pair<T1 extends java.lang.Comparable<? super T1>,T2 extends java.lang.Comparable<? super T2>>
      extends java.lang.Object
      implements java.lang.Comparable<Pair<T1,T2>>

  A class for storing an ordered pair of objects.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Pair(T1 first, T2 second)` Creates a new Pair.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(Pair<T1,T2> o)` Compares the pair to another pair with priority given to the first object.
    `boolean` | `equals(java.lang.Object obj)` Returns whether this pair is equal to the given object.
    `T1` | `getFirst()` Returns the first element of the pair.
    `T2` | `getSecond()` Returns the second element of the pair.
    `int` | `hashCode()` Hashes this pair using the hashes of both its elements.
    `java.lang.String` | `toString()` Returns a string representation of the pair as the string representations of the pair`s elements separated by a comma in parenthesis.

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Pair

          public Pair(T1 first,
                      T2 second)

      Creates a new Pair.
      Parameters:
        `first` - the first member of the pair
        `second` - the second member of the pair

  - ### Method Detail

    - #### getFirst

          public T1 getFirst()

      Returns the first element of the pair.
      Returns:
        the first element of the pair.

    - #### getSecond

          public T2 getSecond()

      Returns the second element of the pair.
      Returns:
        the second element of the pair.

    - #### compareTo

          public int compareTo(Pair<T1,T2> o)

      Compares the pair to another pair with priority given to the first object.
      Specified by:
        `compareTo` in interface `java.lang.Comparable<Pair<T1 extends java.lang.Comparable<? super T1>,T2 extends java.lang.Comparable<? super T2>>>`
      Parameters:
        `o` - the pair to compare to
      Returns:
        the result of the comparison.

    - #### toString

          public java.lang.String toString()

      Returns a string representation of the pair as the string representations of the pair`s elements separated by a comma in parenthesis.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the pair.

    - #### equals

          public boolean equals(java.lang.Object obj)

      Returns whether this pair is equal to the given object. Always false if the given object is not a `Pair`. Pairs are compared using the `equals` method to compare both members of each pair.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object to compare this pair to
      Returns:
        whether the given object is a pair equal to this one

    - #### hashCode

          public int hashCode()

      Hashes this pair using the hashes of both its elements.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        a hash corresponding to this pair.