Interface Pair<A,​B>

  • Type Parameters:
    A - the left value
    B - the right value

    @Immutable
    public interface Pair<A,​B>
    Represent an immutable pair of values.
    • Method Detail

      • of

        static <U,​V> Pair<U,​V> of​(U one,
                                              V two)
        Create a new Pair.
        Type Parameters:
        U - left value type
        V - right value type
        Parameters:
        one - the left value, non-null
        two - the right value, non-null
        Returns:
        a new Pair
      • of

        static <U,​V> Pair<U,​V> of​(java.util.Map.Entry<U,​V> entry)
        Create a new Pair from an existing map entry.
        Type Parameters:
        U - key type
        V - value type
        Parameters:
        entry - an entry to convert to a Pair
        Returns:
        a new Pair
      • first

        @Parameter
        A first()
        The first value in the pair.
        Returns:
        the first value
      • second

        @Parameter
        B second()
        The second value in the pair.
        Returns:
        the first value