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 parameter -= 2;
22 return parameter;
23 }
24
25 int methodTwo(int parameter) {
26 if (parameter <= 0 ) {
27 throw new IllegalArgumentException("A positive value is expected");
28 }
29 int local = parameter;
30 local -= 2;
31 return local;
32 }
33
34 IntPredicate obj = a -> ++a == 12;
35 IntBinaryOperator obj2 = (int a, int b) -> {
36 a++;
37 b += 12;
38 return a + b;
39 };
40 IntPredicate obj3 = a -> {
41 int b = a;
42 return ++b == 12;
43 };
44 }
45