1
2
3
4
5
6
7
8 package com.puppycrawl.tools.checkstyle.checks.coding.unnecessaryparentheses;
9
10 import java.util.List;
11
12
13 class Example1 {
14
15 public int square(int a, int b) {
16
17 int square = (a * b);
18
19 return (square);
20 }
21
22 int sumOfSquares = 0;
23 public void sumOfSquares() {
24
25 for (int i = (0); i < 10; i++) {
26
27 int x = (i + 1);
28 sumOfSquares += (square(x,x));
29 }
30 }
31
32 List<String> myList = List.of("a1", "b1", "c1");
33 public void filter() {
34 myList.stream()
35
36 .filter((s) -> s.startsWith("c"))
37 .forEach(System.out::println);
38 }
39
40 int a = 10, b = 12, c = 15;
41 boolean x = true, y = false, z = true;
42 public void test() {
43
44 if ((a >= 0 && b <= 9) || (c >= 5 && b <= 5) || (c >= 3 && a <= 7)) {
45 return;
46 }
47
48 if ((-a) != -27 && b > 5) {
49 return;
50 }
51 if (x == (a <= 15)) {
52 return;
53 }
54 if (x == (y == z)) {
55 return;
56 }
57 }
58
59 }
60