1   package com.puppycrawl.tools.checkstyle.checks.coding.finallocalvariable;
2   	
3   public class InputFinalLocalVariableEnhancedForLoopVariable {
4       public void method1()
5       {
6           final java.util.List<Object> list = new java.util.ArrayList<>();
7   
8           for(Object a : list){
9           }
10      }
11      
12      public void method2()
13      {
14          final int[] squares = {0, 1, 4, 9, 16, 25};
15          int x;
16          for (final int i : squares) {
17          }
18          
19      }
20  
21      public java.util.List<String> method3(java.util.List<String> snippets) {
22          java.util.List<String> filteredSnippets = new java.util.ArrayList<>();
23          for (String snippet : snippets) {
24              filteredSnippets.add(snippet);
25          }
26          if (filteredSnippets.size() == 0) {
27              String snippet = snippets.get(0);
28              snippet = new String(snippet);
29              filteredSnippets.add(snippet);
30          }
31          return filteredSnippets;
32      }
33  
34      public void method4()
35      {
36          final java.util.List<Object> list = new java.util.ArrayList<>();
37  
38          for(Object a : list) {
39          }
40  
41          Object a;
42          if (list.isEmpty())
43          {
44              a = new String("empty");
45          }
46          else
47          {
48              a = new String("not empty");
49          }
50  
51          for(Object b : list) {
52              b = new String("b");
53          }
54      }
55      
56  }