Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0cfd778

Browse files
committed
Java: Add some examples of functional interfaces for functions with two parameters.
1 parent 3b109db commit 0cfd778

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package p;
2+
3+
@FunctionalInterface
4+
public interface MyFunction<T1, T2, T3> {
5+
T3 apply(T1 x, T2 y);
6+
}

java/ql/test/utils/model-generator/typebasedflow/p/TypeBasedComplex.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,16 @@ public TypeBasedComplex<T> returnComplex(Function<T, TypeBasedComplex<T>> f) {
4444
public void set(Integer x, Function<Integer, T> f) {
4545
throw null;
4646
}
47+
48+
public Integer applyMyFunction(MyFunction<T, Integer, T> f, Integer x) {
49+
throw null;
50+
}
51+
52+
public <S1, S2> S2 applyMyFunctionGeneric(MyFunction<T, S1, S2> f, S1 x) {
53+
throw null;
54+
}
55+
56+
public <S1, S2, S3> S3 applyMyFunctionGeneric(MyFunction<S1, S2, S3> f, S1 x, S2 y) {
57+
throw null;
58+
}
4759
}

0 commit comments

Comments
 (0)