Class Pair<T,U>

java.lang.Object
sk.iway.iwcm.utils.Pair<T,U>

public class Pair<T,U> extends Object
Pair.java An ordered 2-tuple, containing objects passed as arguments to constructor. Can be used in methods that seemingly ought to return 2 values. Those methods can return an instance of Pair class, without the need to construct a new class.
See Also:
  • Field Details

    • first

      public final T first
    • second

      public final U second
  • Constructor Details

    • Pair

      public Pair(T first, U second)
  • Method Details

    • of

      public static <T, U> Pair<T,U> of(T first, U second)
    • getFirst

      public T getFirst()
    • getSecond

      public U getSecond()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object