Is there a PriorityQueue implementation with fixed capacity and custom comparator?
How can you say Lucene's doesn't support a custom comparator?
Its abstract and you must implement the abstract method lessThan(T a, T b)
You could use a SortedSet e.g. TreeSet with a custom comparator and remove the smallest when the size reachs N.
Though an old question but it may be helpful to somebody else. You can use minMaxPriorityQueue of Google's Java library guava.