Class Pair<A,B>

java.lang.Object
org.openstreetmap.josm.tools.Pair<A,B>
Type Parameters:
A - Type of first item
B - Type of second item

public final class Pair<A,B> extends Object
A pair of objects.
Since:
429
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The first item
    The second item
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pair(A a, B b)
    Constructs a new Pair.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <U, V> Pair<U,V>
    create(U u, V v)
    Convenient constructor method
    boolean
    equals(Object other)
     
    int
     
    static <T> Pair<T,T>
    sort(Pair<T,T> p)
    Sorts a single-typed pair so a <= b.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • a

      public A a
      The first item
    • b

      public B b
      The second item
  • Constructor Details

    • Pair

      public Pair(A a, B b)
      Constructs a new Pair.
      Parameters:
      a - The first item
      b - The second item
  • Method Details

    • hashCode

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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • sort

      public static <T> Pair<T,T> sort(Pair<T,T> p)
      Sorts a single-typed pair so a <= b.
      Type Parameters:
      T - type of both elements
      Parameters:
      p - pair
      Returns:
      p
    • toString

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

      public static <U, V> Pair<U,V> create(U u, V v)
      Convenient constructor method
      Type Parameters:
      U - type of first item
      V - type of second item
      Parameters:
      u - The first item
      v - The second item
      Returns:
      The newly created Pair(u,v)