0%
0 / 15 answered
Implementing ArrayList Algorithms Practice Test
•15 QuestionsQuestion
1 / 15
Q1
public class ListFilter
{
public static ArrayList<String> filterByLength(ArrayList<String> words, int len)
{
ArrayList<String> result = new ArrayList<String>();
for (String word : words)
{
if (word.length() == len)
{
result.add(word);
}
}
return result;
}
}
An ArrayList wordList contains <u>"the", "quick", "brown", "fox", "jumps"</u>. What are the contents of the ArrayList returned by the call ListFilter.filterByLength(wordList, 5)?
An ArrayList wordList contains <u>"the", "quick", "brown", "fox", "jumps"</u>. What are the contents of the ArrayList returned by the call ListFilter.filterByLength(wordList, 5)?