ArrayList filter [duplicate] September 14, 2022 by Tarik Billa In java-8, they introduced the method removeIf which takes a Predicate as parameter. So it will be easy as: List<String> list = new ArrayList<>(Arrays.asList("How are you", "How you doing", "Joe", "Mike")); list.removeIf(s -> !s.contains("How")); More Related Contents: When to use LinkedList over ArrayList in Java? Initialization of an ArrayList in one line How do I remove repeated elements from ArrayList? Sorting an ArrayList of objects using a custom sorting order Converting ‘ArrayList to ‘String[]’ in Java How to sort a List/ArrayList? How to count the number of occurrences of an element in a List How to find an object in an ArrayList by property How to sort an ArrayList in Java [duplicate] Which Java Collection should I use? How to randomize two ArrayLists in the same fashion? How do I make my ArrayList Thread-Safe? Another approach to problem in Java? How to sort an ArrayList using multiple sorting criteria? Best way to create a hashmap of arraylist Add multiple items to an already initialized arraylist in Java How to remove element from ArrayList by checking its value? Empty an ArrayList or just create a new one and let the old one be garbage collected? [duplicate] ArrayList Vs LinkedList ArrayList: how does the size increase? What is the Simplest Way to Reverse an ArrayList? ArrayList vs LinkedList from memory allocation perspective Vector vs Collections.synchronizedList(ArrayList) Does the capacity of ArrayList decrease when we remove elements? How to remove common values from two array lists How to sort Arraylist of objects Why there is no ConcurrentHashSet against ConcurrentHashMap What is the most efficient Java Collections library? [closed] What is the time complexity performance of HashSet.contains() in Java? Load arrayList data into JTable Using contains on an ArrayList with integer arrays