Collections and Generics
© examsiri.com
Question : 52 of 53
Marks:
+1,
-0
Given that
Which declarations could be inserted at // INSERT DECLARATION HERE so that the program will compile and run? (Choose all that apply.)
String implements java.lang.CharSequence, and:
import java.util.*;
public class LongWordFinder {
  public static void main(String[] args) {
   String[] array = { "123", "12345678", "1", "12", "1234567890"};
   List < String > list = Arrays.asList(array);
   Collection < String > resultList = getLongWords(list);
  }
  /* INSERT DECLARATION HERE*/
{
   Collection < E > longWords = new ArrayList < E > ();
   for (E word : coll)
   if (word.length() > 6) longWords.add(word);
   return longWords;
  } } Which declarations could be inserted at // INSERT DECLARATION HERE so that the program will compile and run? (Choose all that apply.)
Go to Question: