Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,12 +1,8 @@
|
|||
import java.util.function.Function;
|
||||
|
||||
public class Compose {
|
||||
public static <A,B,C> Function<A,C> compose(Function<B,C> f, Function<A,B> g) {
|
||||
return x -> f.apply(g.apply(x));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Function<Double,Double> sin_asin = compose(Math::sin, Math::asin);
|
||||
Function<Double,Double> sin_asin = ((Function<Double,Double>)Math::sin).compose(Math::asin);
|
||||
|
||||
System.out.println(sin_asin.apply(0.5)); // prints "0.5"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue