All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.tonivade.purefun.CheckedFunction2 Maven / Gradle / Ivy

/*
 * Copyright (c) 2018-2019, Antonio Gabriel Muñoz Conejo 
 * Distributed under the terms of the MIT License
 */
package com.github.tonivade.purefun;

@FunctionalInterface
public interface CheckedFunction2 {

  R apply(A a, B b) throws Throwable;

  default CheckedFunction1> curried() {
    return a -> b -> apply(a, b);
  }

  default CheckedFunction1, R> tupled() {
    return tuple -> apply(tuple.get1(), tuple.get2());
  }

  default  CheckedFunction2 andThen(CheckedFunction1 after) {
    return (a, b) -> after.apply(apply(a, b));
  }

  default  CheckedFunction1 compose(CheckedFunction1 beforeA, CheckedFunction1 beforeB) {
    return value -> apply(beforeA.apply(value), beforeB.apply(value));
  }

  static  CheckedFunction2 of(CheckedFunction2 reference) {
    return reference;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy