Class Pair<X,Y>

java.lang.Object
com.supermartijn642.fusion.api.util.Pair<X,Y>

public class Pair<X,Y> extends Object
Created 23/07/2022 by SuperMartijn642
  • Method Details

    • of

      public static <X, Y> Pair<X,Y> of(X left, Y right)
    • left

      public X left()
    • right

      public Y right()
    • mapLeft

      public <S> Pair<S,Y> mapLeft(Function<X,S> mapper)
      Applies the given mapper to the left value.
    • mapRight

      public <S> Pair<X,S> mapRight(Function<Y,S> mapper)
      Applies the given mapper to the right value.
    • map

      public <R, S> Pair<R,S> map(Function<X,R> mapLeft, Function<Y,S> mapRight)
      Applies the respective mapper to the left or right values.
    • flatMap

      public <S> S flatMap(BiFunction<X,Y,S> mapper)
      Maps the values held by this pair to an object of type Pair.
    • apply

      public void apply(BiConsumer<X,Y> consumer)
      Applies the given consumer to the values held by this pair.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object