Interface ObjectIntPair<K>

All Superinterfaces:
Pair<K,Integer>
All Known Implementing Classes:
ObjectIntImmutablePair, ObjectIntMutablePair

public interface ObjectIntPair<K> extends Pair<K,Integer>
A type-specific Pair; provides some additional methods that use polymorphism to avoid (un)boxing.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K> Comparator<ObjectIntPair<K>>
    Returns a lexicographical comparator for pairs.
    static <K> ObjectIntPair<K>
    of(K left, int right)
    Returns a new type-specific immutable Pair with given left and right value.
    default Integer
    Deprecated.
    Please use the corresponding type-specific method instead.
    default ObjectIntPair<K>
    right(int r)
    Sets the right element of this pair (optional operation).
    default ObjectIntPair<K>
    Deprecated.
    Please use the corresponding type-specific method instead.
    int
    Returns the right element of this pair.
    default Integer
    Deprecated.
    Please use the corresponding type-specific method instead.
    default ObjectIntPair<K>
    second(int r)
    Sets the right element of this pair (optional operation).
    default ObjectIntPair<K>
    Deprecated.
    Please use the corresponding type-specific method instead.
    default int
    Returns the right element of this pair.
    default Integer
    Deprecated.
    Please use the corresponding type-specific method instead.
    default ObjectIntPair<K>
    value(int r)
    Sets the right element of this pair (optional operation).
    default ObjectIntPair<K>
    Deprecated.
    Please use the corresponding type-specific method instead.
    default int
    Returns the right element of this pair.

    Methods inherited from interface it.unimi.dsi.fastutil.Pair

    first, first, key, key, left, left
  • Method Details

    • rightInt

      int rightInt()
      Returns the right element of this pair.
      Returns:
      the right element of this pair.
    • right

      @Deprecated default Integer right()
      Deprecated.
      Please use the corresponding type-specific method instead.
      Returns the right element of this pair.
      Specified by:
      right in interface Pair<K,Integer>
      Returns:
      the right element of this pair.
    • right

      default ObjectIntPair<K> right(int r)
      Sets the right element of this pair (optional operation).
      Parameters:
      r - a new value for the right element.
      Implementation Specification:
      This implementation throws an UnsupportedOperationException.
    • right

      @Deprecated default ObjectIntPair<K> right(Integer l)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Sets the right element of this pair (optional operation).
      Specified by:
      right in interface Pair<K,Integer>
      Parameters:
      l - a new value for the right element.
    • secondInt

      default int secondInt()
      Returns the right element of this pair.
      Returns:
      the right element of this pair.
      Implementation Specification:
      This implementation delegates to right().
    • second

      @Deprecated default Integer second()
      Deprecated.
      Please use the corresponding type-specific method instead.
      Returns the right element of this pair.
      Specified by:
      second in interface Pair<K,Integer>
      Returns:
      the right element of this pair.
    • second

      default ObjectIntPair<K> second(int r)
      Sets the right element of this pair (optional operation).
      Parameters:
      r - a new value for the right element.
      Implementation Specification:
      This implementation delegates to Pair.right(Object).
    • second

      @Deprecated default ObjectIntPair<K> second(Integer l)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Sets the right element of this pair (optional operation).
      Specified by:
      second in interface Pair<K,Integer>
      Parameters:
      l - a new value for the right element.
    • valueInt

      default int valueInt()
      Returns the right element of this pair.
      Returns:
      the right element of this pair.
      Implementation Specification:
      This implementation delegates to right().
    • value

      @Deprecated default Integer value()
      Deprecated.
      Please use the corresponding type-specific method instead.
      Returns the right element of this pair.
      Specified by:
      value in interface Pair<K,Integer>
      Returns:
      the right element of this pair.
    • value

      default ObjectIntPair<K> value(int r)
      Sets the right element of this pair (optional operation).
      Parameters:
      r - a new value for the right element.
      Implementation Specification:
      This implementation delegates to Pair.right(Object).
    • value

      @Deprecated default ObjectIntPair<K> value(Integer l)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Sets the right element of this pair (optional operation).
      Specified by:
      value in interface Pair<K,Integer>
      Parameters:
      l - a new value for the right element.
    • of

      static <K> ObjectIntPair<K> of(K 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.
    • lexComparator

      static <K> Comparator<ObjectIntPair<K>> lexComparator()
      Returns a lexicographical comparator for pairs.

      The comparator returned by this method implements lexicographical order. It compares first the left elements: if the result of the comparison is nonzero, it returns said result. Otherwise, this comparator returns the result of the comparison of the right elements.

      Returns:
      a lexicographical comparator for pairs.