forked from Apress/functional-interfaces-in-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSect10_Ex1.java
More file actions
20 lines (19 loc) · 755 Bytes
/
Sect10_Ex1.java
File metadata and controls
20 lines (19 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package chapter4;
import java.util.function.ToIntBiFunction;
import java.util.function.ToLongBiFunction;
import java.util.function.ToDoubleBiFunction;
public class Sect10_Ex1
{
public static void main(String[] args)
{
ToIntBiFunction<String, Double> tib = (x,z) ->
Integer.parseInt(x) + (new Double(z)).intValue();
ToLongBiFunction<Double, String> tlb = (x,z) ->
x.longValue() + Long.parseLong(z);
ToDoubleBiFunction<Integer, Long> tdb = (x,z) ->
(new Integer(x)).doubleValue() + (new Long(z)).doubleValue();
System.out.println(tib.applyAsInt("5",4.2));
System.out.println(tlb.applyAsLong(5.1, "6"));
System.out.println(tdb.applyAsDouble(7, 8L));
}
}