Class Pair<F,S>

java.lang.Object
com.atlassian.jira.util.lang.Pair<F,S>
Type Parameters:
F - type of the first element
S - type of the second element

@ThreadSafe public final class Pair<F,S> extends Object
Immutable, generic pair of values. How coool is that!
Since:
v4.2
  • Method Details

    • of

      public static <U, V> Pair<U,V> of(U first, V second)
      By default we create a strict pair of non-null values.
      Type Parameters:
      U - type of first value
      V - type of second value
      Parameters:
      first - first value
      second - second value
      Returns:
      new pair
      See Also:
    • strictPairOf

      public static <U, V> Pair<U,V> strictPairOf(@Nonnull U first, @Nonnull V second)
      A pair that doesn't allow null values.
      Type Parameters:
      U - type of first value
      V - type of second value
      Parameters:
      first - first value, may not be null
      second - second value, may not be null
      Returns:
      new strict pair
    • nicePairOf

      public static <U, V> Pair<U,V> nicePairOf(@Nullable U first, @Nullable V second)
      A pair that does allows null values.
      Type Parameters:
      U - type of first value
      V - type of second value
      Parameters:
      first - first value, may be null
      second - second value, may be null
      Returns:
      new nice pair
    • first

      public F first()
    • second

      public S second()
    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object