File tree 2 files changed +12
-8
lines changed
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,20 @@ public enum JobTitle {
19
19
private static ImmutableSet <JobTitle > OPERATIONAL =
20
20
ImmutableSet .of (MANAGER , OFFICER );
21
21
22
- public static Predicate < JobTitle > isAdministrative () {
23
- return title -> ADMINISTRATION .contains (title );
22
+ public boolean isAdministration () {
23
+ return ADMINISTRATION .contains (this );
24
24
}
25
25
26
- public static Predicate < JobTitle > isOperational () {
27
- return title -> OPERATIONAL .contains (title );
26
+ public boolean isOperational () {
27
+ return OPERATIONAL .contains (this );
28
28
}
29
29
30
- public static Predicate <JobTitle > isBusiness () {
31
- return isAdministrative ().or (isOperational ());
30
+ public static Predicate <JobTitle > administration () {
31
+ return JobTitle ::isAdministration ;
32
+ }
33
+
34
+ public static Predicate <JobTitle > operational () {
35
+ return JobTitle ::isOperational ;
32
36
}
33
37
34
38
public static Stream <JobTitle > stream () {
Original file line number Diff line number Diff line change 2
2
3
3
import org .junit .Test ;
4
4
5
- import static job .JobTitle .isBusiness ;
5
+ import static job .JobTitle .* ;
6
6
7
7
/**
8
8
* Created by mtumilowicz on 2018-11-07.
@@ -12,7 +12,7 @@ public class JobTitleTest {
12
12
@ Test
13
13
public void isBusinessShowcase () {
14
14
JobTitle .stream ()
15
- .filter (isBusiness ( ))
15
+ .filter (administration (). or ( operational () ))
16
16
.forEach (title -> System .out .println ("Performed action for: " + title ));
17
17
}
18
18
}
You can’t perform that action at this time.
0 commit comments