Write code to contains Any
//package com.book2s; import java.util.Arrays; public class Main { public static void main(String[] argv) { String str = "book2s.com"; String searchStrings = "o"; System.out.println(containsAny(str, searchStrings)); }//w w w. j a v a2 s . c om public static boolean containsAny(final String str, final String... searchStrings) { return Arrays.stream(searchStrings).anyMatch(s -> str.contains(s)); } }