View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespaceafter;
2   
3   public class InputWhitespaceAfterLiteralFor {
4   
5       boolean condition() {
6           return false;
7       }
8   
9       void testIfElse() {
10          //Valid
11          if (condition()) {
12              testIfElse();
13          } else {
14              testIfElse();
15          }
16  
17          //Invalid
18          if(condition()) {                  //violation
19              testIfElse();
20          } else {
21              testIfElse();
22          }
23  
24          //Invalid
25          if (condition()) {
26              testIfElse();
27          } else{                            //violation
28              testIfElse();
29          }
30      }
31  
32      void testWhile() {
33          //Valid
34          while (condition()) {
35              testWhile();
36          }
37  
38          //Invalid
39          while(condition()) {               //violation
40              testWhile();
41          }
42      }
43  
44      void testFor() {
45          //Valid
46          for (int i = 0; i < 5; i++) {
47              testFor();
48          }
49  
50          //Invalid
51          for(int i = 0; i < 5; i++) {      //violation
52              testFor();
53          }
54      }
55  
56      void testDo() {
57          //Valid
58          do {
59              testDo();
60          } while (condition());
61  
62          //Invalid
63          do{                             //violation
64              testDo();
65          } while (condition());
66      }
67  }