Class 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 Detail

      • a

        public A a
        The first item
      • b

        public B b
        The second item
    • Constructor Detail

      • Pair

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

      • 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
      • 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)