سؤال

File spf = new File(setspath);
//
List lst =  new List();
lst.add(sourcej);
lst.add(folname);
lst.add(chosenBackup);
//
FileUtils.writeLines(spf, lst);

I get this error "The method writeLines(File, Collection) in the type FileUtils is not applicable for the arguments (File, List)" in eclipse

I'm guessing you have to make List into a Collection, but I can't find how to do that anywhere. Help?

هل كانت مفيدة؟

المحلول

Although a List is a subclass of Collection it is not a class; it is an interface. On your second line, you cannot construct an object of type List.

If you use an ArrayList instead (e.g.: List lst = new ArrayList();, and import java.util.ArrayList) what youa re doing should work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top