public void testBasic() {
final Random random = new Random();
final List items = new LinkedList();
final BinaryHeapQueue queue = new BinaryHeapQueue( NaturalComparator.INSTANCE,
100000 );
for ( int i = 0; i < 100000; ++i ) {
items.add( new LongQueueable( queue, random.nextLong() ) );
}
final long startEnqueue = System.currentTimeMillis();
for ( final Iterator i = items.iterator(); i.hasNext(); ) {
queue.enqueue( (Queueable) i.next() );
}
final long elapsedEnqueue = System.currentTimeMillis() - startEnqueue;
final long startDequeue = System.currentTimeMillis();
for ( final Iterator i = items.iterator(); i.hasNext(); ) {
queue.enqueue( (Queueable) i.next() );
}
// while (!queue.isEmpty()) {
// queue.pop();
// }