0
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?

Edwin Grace
  • 5
  • 1
  • 2
  • are you sure that *List lst = new List();* even compiles? List is an interface, it cannot be instantiated. You should do List lst = new ArrayList(); instead – Thousand Jul 16 '13 at 22:29

1 Answers1

3

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.

Kaushik Shankar
  • 5,491
  • 4
  • 30
  • 36