Java Collections Sort not accepting comparator constructor with arg
Posted
by harmzl
on Stack Overflow
See other posts from Stack Overflow
or by harmzl
Published on 2010-04-17T22:26:26Z
Indexed on
2010/04/17
22:33 UTC
Read the original article
Hit count: 375
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...
© Stack Overflow or respective owner