-
-
Save brilianfird/4a88c8d34aa998fb4c8e80306cff7dde to your computer and use it in GitHub Desktop.
This file contains 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
List<String> stringList = Arrays.asList("Hello", "World", "How", "Are", "You", "Today"); | |
// imperative declaration | |
List<String> filteredList = new ArrayList<>(); | |
for (String string: stringList) { | |
if (string.equals("Hello") || string.equals("Are")) { | |
filteredList.add(string); | |
} | |
} | |
List<String> mappedList = new ArrayList<>(); | |
for (String string: filteredList) { | |
mappedList.add(string + " String"); | |
} | |
for (String string: mappedList) { | |
System.out.println(string); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment