in drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/datastructures/QueueBenchmark.java [46:69]
public int benchmark() {
for (int i = 0; i < size; i++) {
queue.enqueue(values[i]);
}
while (true) {
// remove and entry in the middle ...
StringQueueEntry entry = values[queue.size() / 2];
queue.dequeue(entry);
// ... and one at the end
queue.dequeue();
// if the queue is empty terminates the benchmark
if (queue.isEmpty()) {
break;
}
// otherwise enqueue again the item that was in the middle
queue.enqueue(entry);
}
return queue.size();
}