[Solved] Java Array Searching [closed]


You could stream the array, and filter using String::contains.

String[] words = {"bad", "bat","hat"};
String filter = "at";

List<String> list = Stream.of(words)
        .filter(word -> word.contains(filter))
        .collect(Collectors.toList());

System.out.println(list);

solved Java Array Searching [closed]