Class Pair<LeftT,​RightT>

  • Type Parameters:
    LeftT - Left type
    RightT - Right Type

    public final class Pair<LeftT,​RightT>
    extends Object
    Simple struct of two values, possibly of different types.
    • Method Detail

      • left

        public LeftT left()
        Returns:
        Left value
      • right

        public RightT right()
        Returns:
        Right value
      • apply

        public <ReturnT> ReturnT apply​(BiFunction<LeftT,​RightT,​ReturnT> function)
        Apply the function to both the left and right values and return the transformed result.
        Type Parameters:
        ReturnT - Transformed return type of BiFunction.
        Parameters:
        function - Function to apply on the Pair
        Returns:
        Result of BiFunction applied on left and right values of the pair.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • of

        public static <LeftT,​RightT> Pair<LeftT,​RightT> of​(LeftT left,
                                                                       RightT right)