1
2
3
4
5
6
7
8
9
10 package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
11
12 public class InputRightCurlyTestOptionAloneOrSingleLine {
13
14 private int a;
15 private static int b;
16 { a = 2; }
17 static { b = 3; }
18
19 void method1() {
20 Thread t = new Thread() {@Override public void run() {
21 int a; int b;}
22 };
23 }
24
25 void method2(java.util.HashSet<String> set) {
26 java.util.Map<String, String> map1 = new java.util.LinkedHashMap<String, String>() {{
27 put("Hello", "World");
28 put("first", "second");
29 put("polygene", "lubricants");
30 put("alpha", "betical");}
31 };
32
33 java.util.Map<String, String> map2 = new java.util.LinkedHashMap<String, String>() {{
34 put("Hello", "World");
35 put("first", "second");
36 put("polygene", "lubricants");
37 put("alpha", "betical");
38 }};;
39 }
40
41 void method3() {
42 method2(new java.util.HashSet<String>() {{
43 add("XZ13s");
44 add("AB21/X");
45 add("YYLEX");
46 add("AR5E");
47 }});
48 }
49
50 int method4(int a) {
51 if (a>2) a*=10; return ++a; }
52
53 void method5(int a) {
54 while (a > 5) { a--; }
55
56 if (a > 4) { a++; }
57
58 do {a--;} while (a > 3);
59
60 for (int i = 1; i < 10; i++) { byte b = 10; }
61
62 if (a < 2) { --a; } else if (a > 3) { a++; }
63
64 java.util.List<String> list = new java.util.ArrayList<>();
65 list.stream()
66 .filter(e -> {return !e.isEmpty() && !"null".equals(e);} )
67 .collect(java.util.stream.Collectors.toList());
68 }
69
70 class TestClass4 { }
71
72 class TestClass5 { } { }
73
74 interface Interface1
75 {
76 int i = 1;
77 public void meth1(); }
78
79 interface Interface2
80 { int i = 1; public void meth1(); }
81
82 interface Interface3 {
83 void display();
84 interface Interface4 {
85 void myMethod();
86 }}
87 }