Created
August 23, 2016 15:02
-
-
Save rangalo/7f7af419e85b0a056f27fcd0c624cf45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main (String[] args) { | |
List<String> fruits = new ArrayList<>(); | |
fruits.add("Apple"); | |
fruits.add("Banana"); | |
fruits.add("Peach"); | |
fruits.add("Orange"); | |
fruits.add("Cherries"); | |
fruits.add("Watermelon"); | |
System.out.println("Before Fruits = " + fruits); | |
for (String fruit : fruits) { | |
if (fruit.length() % 2 == 0) { | |
fruits.remove(fruit); | |
} | |
} | |
System.out.println("After Fruits = " + fruits); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment