View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule42blockindentation;
2   
3   import java.util.ArrayList;
4   import java.util.HashMap;
5   import java.util.Iterator;
6   import java.util.List;
7   import java.util.Map;
8   
9   class InputIndentationCorrectForAndParameter {
10  
11    String getString(int someInt, String someString) {
12      return "String";
13    }
14  
15    void fooMethodWithIf() {
16  
17      for (int i = 1; i < 10; i++) {}
18  
19      for (int i =
20              new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong")
21                  .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong"));
22          i < 10;
23          i++) {}
24  
25      for (Map.Entry<String, String> entry :
26          new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong")
27              .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong"))
28              .entrySet()) {}
29  
30      for (Map.Entry<String, String> entry :
31          new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong")
32              .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong"))
33              .entrySet()) {}
34  
35      for (String string :
36          new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong"))
37              .getList(
38                  new FooForClass(),
39                  1000,
40                  getString(
41                      1024,
42                      "Loooooooooooooooooooooooooooooooo"
43                          + "oooooooooooooooooooooooooooooooooooooooo"
44                          + "oooooooooong"))) {}
45  
46      for (String string :
47          new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong"))
48              .getList(
49                  new FooForClass(),
50                  1000,
51                  getString(
52                      1024,
53                      "Loooooooooooooooooooooooooooooooo"
54                          + "oooooooooooooooooooooooooooooooooooooooo"
55                          + "oooooooooong"))) {}
56    }
57  
58    class InnerClassFoo {
59  
60      void fooMethodWithIf() {
61  
62        for (int i = 1; i < 10; i++) {}
63  
64        for (int i =
65                new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong")
66                    .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong"));
67            i < 10;
68            i++) {}
69  
70        for (Map.Entry<String, String> entry :
71            new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong")
72                .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong"))
73                .entrySet()) {}
74  
75        for (Map.Entry<String, String> entry :
76            new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong")
77                .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong"))
78                .entrySet()) {}
79  
80        for (String string :
81            new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong"))
82                .getList(
83                    new FooForClass(),
84                    1000,
85                    getString(
86                        1024,
87                        "Loooooooooooooooooooooooooooooooo"
88                            + "oooooooooooooooooooooooooooooooooooooooo"
89                            + "oooooooooong"))) {}
90  
91        for (String string :
92            new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong"))
93                .getList(
94                    new FooForClass(),
95                    1000,
96                    getString(
97                        1024,
98                        "Loooooooooooooooooooooooooooooooo"
99                            + "oooooooooooooooooooooooooooooooooooooooo"
100                           + "oooooooooong"))) {}
101     }
102   }
103 
104   class SecondForClassWithLongName1 implements Iterable<String> {
105 
106     public SecondForClassWithLongName1(String string) {}
107 
108     int getInteger(FooForClass instance, String string) {
109       return -1;
110     }
111 
112     Map<String, String> getMap(FooForClass instance, int integer, String string) {
113       return new HashMap<String, String>();
114     }
115 
116     List<String> getList(FooForClass instance, long longLong, String string) {
117       return new ArrayList<String>();
118     }
119 
120     public Iterator<String> iterator() {
121       return null;
122     }
123   }
124 
125   class FooForClass {}
126 }