forked from int28h/JavaTasks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9.java
More file actions
20 lines (18 loc) · 915 Bytes
/
9.java
File metadata and controls
20 lines (18 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
You need to write your own functional interface (TernaryIntPredicate) and use it with a lambda expression.
The interface must have a single non-static (and non-default) method test with three int arguments that returns boolean value.
Besides, you need to write a lambda expression with three int arguments using your TernaryIntPredicate.
The lambda expression has to return true if all passed values are different otherwise false.
The name of the instance is allValuesAreDifferentPredicate. It should be a static field.
*/
@FunctionalInterface
public interface TernaryIntPredicate {
public boolean test(int one, int two, int three);
}
public static final TernaryIntPredicate allValuesAreDifferentPredicate = new TernaryIntPredicate() {
@Override
public boolean test(int one, int two, int three) {
if(one != two && one != three && two != three) return true;
return false;
}
};