In Java please, fill in "/* Your code goes here */" only Find the positions of all strings equal to a given string in an array list of strings. Adapt the algorithm from "Linear Search" in the "Common Array Algorithms" section. Instead of stopping at the first match, collect all positions. Complete the following code. import java.util.ArrayList; public class ArrayListUtil { /** Finds the positions of all strings equal to a given string in an array list of strings. @param words an array list of strings @param searchedWord the word to search for @return an array list of all matching positions */ public static ArrayList findAll(/* Your code goes here */ words, /* Your code goes here */ searchedWord) { /* Your code goes here */ } }
In Java please, fill in "/* Your code goes here */" only
Find the positions of all strings equal to a given string in an array list of strings. Adapt the
import java.util.ArrayList;
public class ArrayListUtil
{
/**
Finds the positions of all strings equal to a given string
in an array list of strings.
@param words an array list of strings
@param searchedWord the word to search for
@return an array list of all matching positions
*/
public static ArrayList</* Your code goes here */> findAll(/* Your code goes here */ words, /* Your code goes here */ searchedWord)
{
/* Your code goes here */
}
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images