Interface Pair<L,​R>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default L first()
      Returns the left element of this pair.
      default Pair<L,​R> first​(L l)
      Sets the left element of this pair (optional operation).
      default L key()
      Returns the left element of this pair.
      default Pair<L,​R> key​(L l)
      Sets the left element of this pair (optional operation).
      L left()
      Returns the left element of this pair.
      default Pair<L,​R> left​(L l)
      Sets the left element of this pair (optional operation).
      static <L,​R>
      Pair<L,​R>
      of​(L l, R r)
      Returns a new immutable Pair with given left and right value.
      R right()
      Returns the right element of this pair.
      default Pair<L,​R> right​(R r)
      Sets the right element of this pair (optional operation).
      default R second()
      Returns the right element of this pair.
      default Pair<L,​R> second​(R r)
      Sets the right element of this pair (optional operation).
      default R value()
      Returns the right element of this pair.
      default Pair<L,​R> value​(R r)
      Sets the right element of this pair (optional operation).
    • Method Detail

      • left

        L left()
        Returns the left element of this pair.
        Returns:
        the left element of this pair.
      • right

        R right()
        Returns the right element of this pair.
        Returns:
        the right element of this pair.
      • left

        default Pair<L,​R> left​(L l)
        Sets the left element of this pair (optional operation).
        Parameters:
        l - a new value for the left element.
        Implementation Notes:
        This implementation throws an UnsupportedOperationException.
      • right

        default Pair<L,​R> right​(R r)
        Sets the right element of this pair (optional operation).
        Parameters:
        r - a new value for the right element.
        Implementation Notes:
        This implementation throws an UnsupportedOperationException.
      • first

        default L first()
        Returns the left element of this pair.
        Returns:
        the left element of this pair.
        Implementation Notes:
        This implementation delegates to left().
      • second

        default R second()
        Returns the right element of this pair.
        Returns:
        the right element of this pair.
        Implementation Notes:
        This implementation delegates to right().
      • first

        default Pair<L,​R> first​(L l)
        Sets the left element of this pair (optional operation).
        Parameters:
        l - a new value for the left element.
        Implementation Notes:
        This implementation delegates to left(Object).
      • second

        default Pair<L,​R> second​(R r)
        Sets the right element of this pair (optional operation).
        Parameters:
        r - a new value for the right element.
        Implementation Notes:
        This implementation delegates to right(Object).
      • key

        default Pair<L,​R> key​(L l)
        Sets the left element of this pair (optional operation).
        Parameters:
        l - a new value for the left element.
        Implementation Notes:
        This implementation delegates to left(Object).
      • value

        default Pair<L,​R> value​(R r)
        Sets the right element of this pair (optional operation).
        Parameters:
        r - a new value for the right element.
        Implementation Notes:
        This implementation delegates to right(Object).
      • key

        default L key()
        Returns the left element of this pair.
        Returns:
        the left element of this pair.
        Implementation Notes:
        This implementation delegates to left().
      • value

        default R value()
        Returns the right element of this pair.
        Returns:
        the right element of this pair.
        Implementation Notes:
        This implementation delegates to right().
      • of

        static <L,​R> Pair<L,​R> of​(L l,
                                              R r)
        Returns a new immutable Pair with given left and right value.
        Parameters:
        l - the left value.
        r - the right value.
        Implementation Notes:
        This factory method returns an instance of ObjectObjectImmutablePair.