Class IntIntImmutablePair

  • All Implemented Interfaces:
    IntIntPair, Pair<java.lang.Integer,​java.lang.Integer>, java.io.Serializable
    Direct Known Subclasses:
    IntIntImmutableSortedPair

    public class IntIntImmutablePair
    extends java.lang.Object
    implements IntIntPair, java.io.Serializable
    A type-specific immutable Pair; provides some additional methods that use polymorphism to avoid (un)boxing.
    See Also:
    Serialized Form
    • Constructor Detail

      • IntIntImmutablePair

        public IntIntImmutablePair​(int left,
                                   int right)
        Creates a new type-specific immutable Pair with given left and right value.
        Parameters:
        left - the left value.
        right - the right value.
    • Method Detail

      • of

        public static IntIntImmutablePair of​(int left,
                                             int right)
        Returns a new type-specific immutable Pair with given left and right value.
        Parameters:
        left - the left value.
        right - the right value.
        Implementation Notes:
        This factory method delegates to the constructor.
      • leftInt

        public int leftInt()
        Description copied from interface: IntIntPair
        Returns the left element of this pair.
        Specified by:
        leftInt in interface IntIntPair
        Returns:
        the left element of this pair.
      • rightInt

        public int rightInt()
        Description copied from interface: IntIntPair
        Returns the right element of this pair.
        Specified by:
        rightInt in interface IntIntPair
        Returns:
        the right element of this pair.
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns a string representation of this pair in the form <l,r>.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this pair in the form <l,r>.