/ Published in: Java
                    
                                        
This code uses the new Java 5 foreach loop to iterate through every element of a list. It avoids the need to declare an iterator.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
List<String> listOfStrings = new LinkedList<String>( );
listOfStrings.add("Why");
listOfStrings.add("Iterate");
listOfStrings.add("When");
listOfStrings.add("You");
listOfStrings.add("Can");
listOfStrings.add("Avoid");
listOfStrings.add("It!");
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                