Top N Elements
Sample code for my blog article.
Contains a Java based implementation of an efficient algorithm for selecting the first N elements of a very large collection, according to some user-defined criterion. It is based on the Heap data-structure (the PriorityQueue class in JDK).