X238: listSearch

Write a method called listSearch() that takes in a target string and a list of other strings. This method returns a (possibly shorter) list containing all of the strings from the original list that themselves contain the target string you are searching for. Check for the target string as a case-sensitive substring of every member of the list. You can either modify the provided list or create a new one.

Examples:

listSearch("a", list("a", "an", "being")) -> list("a", "an")
listSearch("ea", list("every", "gator", "eats")) -> list("eats")
listSearch("", list("every", "gator", "eats")) -> list("every", "gator", "eats")
listSearch("anything", list()) -> list()

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.