-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodRefGen4.java
More file actions
42 lines (26 loc) · 826 Bytes
/
MethodRefGen4.java
File metadata and controls
42 lines (26 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
interface MethodRefAdd4<T> {
int add(int a, int b);
}
interface MethodRefAdd5<T> {
int add(int a, int b);
}
class MethodRefAddGen4<T> {
static int add(int a, int b) {
return a + b;
}
}
public class MethodRefGen4<T extends MethodRefAdd4<? extends Number> & MethodRefAdd5<? extends Number>> {
static int add(int a, int b) {
return a + b;
}
static int Add(MethodRefAdd4<Number> a, int b, int c) {
return a.add(b, c);
}
public static void main(String[] args) {
MethodRefAdd4<Integer> a = MethodRefAddGen4::add;
int res = a.add(12, 13);
System.out.println(res);
Integer sum = Add(MethodRefAddGen4::add, 12, 13);
System.out.println(sum);
}
}