import java.io.BufferedReader;
import java.util.Collections;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader
The collection myCelebrityList
is of type CelebrityNamesFile
and that means it can only accept instances of that class. You need to create an instance of CelebrityNamesFile
and add it to the collection. The Collections
wont accept your collection because you class CelebrityNamesFile
does not implement the Comparator
interface. You need to pass your comparator instance to the Collections.sort()
as second parameter.