문제

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