Class ObjectObjectImmutableSortedPair<K extends java.lang.Comparable<K>>

  • All Implemented Interfaces:
    Pair<K,​K>, SortedPair<K>, java.io.Serializable

    public class ObjectObjectImmutableSortedPair<K extends java.lang.Comparable<K>>
    extends ObjectObjectImmutablePair<K,​K>
    implements SortedPair<K>, java.io.Serializable
    A type-specific immutable SortedPair; provides some additional methods that use polymorphism to avoid (un)boxing.
    See Also:
    Serialized Form
    • Method Detail

      • of

        public static <K extends java.lang.Comparable<K>> ObjectObjectImmutableSortedPair<K> of​(K left,
                                                                                                K right)
        Returns a new type-specific immutable SortedPair with given left and right value.

        Note that if left and right are in the wrong order, they will be exchanged.

        Parameters:
        left - the left value.
        right - the right value.
        Implementation Specification:
        This factory method delegates to the constructor.
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class ObjectObjectImmutablePair<K extends java.lang.Comparable<K>,​K extends java.lang.Comparable<K>>
      • toString

        public java.lang.String toString()
        Returns a string representation of this sorted pair in the form {l,r}.
        Overrides:
        toString in class ObjectObjectImmutablePair<K extends java.lang.Comparable<K>,​K extends java.lang.Comparable<K>>
        Returns:
        a string representation of this pair sorted in the form {l,r}.