It's really a basic questions, but still was unable to find an answer to it. i was just messing around with some basic Collection methods (like the below example) and yes, it works perfectly as it should be. Problem isn't really in this code, its more about eclipse i think. Cuz in eclipse everytime when i create smth with "list" word like "List list = new ArrayList();" i got an error. Or when i create it in some other, working way i cant access Collections. options. only Collections.combine i think. sort and all the other isnt really found and dont work ( so i switched to netbeans to make this code work and practise ) and it works perfectly. but how to make this work in eclipse?? p. s. i have imported all the needed things.
ArrayList<String> list2 = new ArrayList<String>();
String[] programs = {"eclipse", "netbeans", "codeblocks", "visual studio"};
ArrayList<String>convertedlist = new ArrayList(Arrays.asList(programs));
convertedlist.add("\nnotepad++");
output(convertedlist);
System.out.println("\nsorted list");
Collections.sort(convertedlist);
output(convertedlist);
System.out.println("\nreverse order");
Collections.sort(convertedlist, Collections.reverseOrder());
output(convertedlist);
System.out.println("\nsecond array element");
programs = convertedlist.toArray(new String[convertedlist.size()]);
System.out.println(programs[1]);
System.out.println("\nfilled list");
Collections.fill(convertedlist, "L");
output(convertedlist);
System.out.println("\nadded all to list2");
Collections.addAll(list2, programs);
output(list2);
System.out.println("\nfrequency of word net beans in list2");
System.out.println(Collections.frequency(list2, "netbeans
public static void output(ArrayList<String> list){
for(String a: list)
System.out.printf("%s ", a);