// Clear the list of shard links.
shardLinks.clear();
// Visit all the children of the shard link group. There is no
// need to visit the shard link group itself.
DissectableElement element = shardLinkGroup.getElement();
document.visitChildren(element, this);
// Create an array from the list as it will not change.
int size = shardLinks.size();
ShardLink[] links = new ShardLink[size];