// Iterate over the batches ...
Batch batch = null;
boolean shouldAdd = true;
while ((batch = seq.nextBatch()) != null) {
while (batch.hasNext()) {
batch.nextRow();
CachedNode node = batch.getNode();
NodeKey key = node != null ? node.getKey() : null;
if (keys.contains(key) && shouldAdd) shouldAdd = false;
if (shouldAdd) {
boolean added = keys.add(key);