1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.coding.parameterassignment;
10
11
12 import java.util.function.IntBinaryOperator;
13 import java.util.function.IntPredicate;
14
15
16 class Example1 {
17 int methodOne(int parameter) {
18 if (parameter <= 0 ) {
19 throw new IllegalArgumentException("A positive value is expected");
20 }
21
22 parameter -= 2;
23 return parameter;
24 }
25
26 int methodTwo(int parameter) {
27 if (parameter <= 0 ) {
28 throw new IllegalArgumentException("A positive value is expected");
29 }
30 int local = parameter;
31 local -= 2;
32 return local;
33 }
34
35 IntPredicate obj = a -> ++a == 12;
36 IntBinaryOperator obj2 = (int a, int b) -> {
37 a++;
38 b += 12;
39 return a + b;
40 };
41 IntPredicate obj3 = a -> {
42 int b = a;
43 return ++b == 12;
44 };
45 }
46