Maybe it would be simpler by iterating forward as this would remove the need for a null check:
```
for (int i = 0; i < sortedShardList.length; ++i) {
    lastEmittedDocPerShard[scoreDoc.shardIndex] = sortedShardList[i];
}
```