Data update
This commit is contained in:
parent
07c7092a52
commit
61b93a2cd1
313 changed files with 6160 additions and 346 deletions
|
|
@ -0,0 +1,24 @@
|
|||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class FirstClassFunctionsUseNumbersAnalogously {
|
||||
|
||||
public static void main(String[] args) {
|
||||
final double x = 2.0, xi = 0.5,
|
||||
y = 4.0, yi = 0.25,
|
||||
z = x + y, zi = 1.0 / ( x + y );
|
||||
|
||||
List<Double> list = List.of( x, y, z );
|
||||
List<Double> inverseList = List.of( xi, yi, zi );
|
||||
|
||||
BiFunction<Double, Double, Function<Double, Double>> multiplier = (a, b) -> product -> a * b * product;
|
||||
|
||||
for ( int i = 0; i < list.size(); i++ ) {
|
||||
Function<Double, Double> multiply = multiplier.apply(list.get(i), inverseList.get(i));
|
||||
final double argument = (double) ( i + 1 );
|
||||
System.out.println(multiply.apply(argument));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue