Java Collections Sort not accepting comparator constructor with arg
- by harmzl
I'm getting a compiler error for this line:
Collections.sort(terms, new QuerySorter_TFmaxIDF(myInteger));
My customized Comparator is pretty basic; here's the signature and constructor:
public class QuerySorter_TFmaxIDF implements Comparator<Term>{
private int numberOfDocs;
QuerySorter_TFmaxIDF(int n){
super();
numberOfDocs = n;
}
}
Is there an error because I'm passing an argument into the Comparator? I need to pass an argument...