Class Pair<L,R>

java.lang.Object
org.rspeer.commons.Pair<L,R>

public class Pair<L,R> extends Object
  • Constructor Details

    • Pair

      public Pair(L left, R right)
  • Method Details

    • getLeft

      public L getLeft()
    • getRight

      public R getRight()
    • getLeft

      public L getLeft(L defaultValue)
    • getRight

      public R getRight(R defaultValue)
    • accumulate

      public <T> T accumulate(BiFunction<L,R,T> function)
    • filter

      public Pair<L,R> filter(BiPredicate<L,R> predicate)
      Parameters:
      predicate - The predicate to test the elements
      Returns:
      The pair if the predicate accepts it, else returns a Pair where the left and right elements are null
    • ifPresent

      public void ifPresent(BiConsumer<L,R> consumer)
      If neither element is null, applies the given consumer
      Parameters:
      consumer - The operation to perform on the elements