Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top