java array methods list code example
Example: arraylist methods in java
// Assign to list variable directly with STREAM FILTER METHID
ArrayList<String> filteredColors = (ArrayList<String>) colors.stream().filter(x -> x.contains("o")).collect(Collectors.toList());
// Clone and remove unwanted(TRADITIONAL FILTERING)
filteredColors = (ArrayList<String>) colors.clone();
filteredColors.removeIf(x -> !x.contains("o"));
// Find specific element
colors.stream().filter(x -> x.contains("ora")).findFirst().get();