Class ComparablePair<A extends Comparable,​B extends Comparable>

  • Type Parameters:
    A - first object in pair
    B - second object in pair
    All Implemented Interfaces:
    Comparable<Pair<A,​B>>

    public class ComparablePair<A extends Comparable,​B extends Comparable>
    extends Pair<A,​B>
    implements Comparable<Pair<A,​B>>
    Custom pair class similar to C++. By default we compare based on the first value
    Author:
    markr
    • Constructor Detail

      • ComparablePair

        protected ComparablePair​(A first,
                                 B second)
        Constructor
        Parameters:
        first - first object in pair
        second - second object in pair
    • Method Detail

      • of

        public static <A extends Comparable,​B extends ComparableComparablePair<A,​B> of​(A valueA,
                                                                                                     B valueB)
        Factory method
        Type Parameters:
        A - type of valueA
        B - type of valueB
        Parameters:
        valueA - first
        valueB - second
        Returns:
        new pair