Q: How to search for a particular word in a string from a arraylist of String I have a string
String string="I would loved to be the part of cricket team"

and I have a arraylist
ArrayList <String> list = new ArrayList(); 
list.add("part");
list.add("bend");
list.add("bet");
list.add("bear");
list.add("beat");
list.add("become");
list.add("begin");

Now I want to search from this string using this arraylist. How can i Do that without using for loop ?

A: Using Java 8 streams:
list.stream()
    .filter(s -> string.contains(s))
    .forEach(System.out::println);


A: You have to check one by one by using String.compare() function.
Is it what you're asking?

A: for (String x : list) {
    if(string.contains(x)) {
        System.out.print(x);
    }
}


A: // Use JAVA 8 feature 
String str = "I would loved to be the part of cricket team";

ArrayList <String> list = new ArrayList(); 
list.add("part");
list.add("bend");
list.add("bet");
list.add("bear");
list.add("beat");
list.add("become"); 
list.add("begin");

boolean anyMatch = list.stream().anyMatch(s -> s.contains(str));

