final List<NodeWithValue<Integer>> nodesToMerge = new ArrayList<NodeWithValue<Integer>>(tries.size());
// Only add valid root nodes
for (final TrieBag t : tries) {
if (checkMetadata && !t.hasCompleteMetadata()){
throw new TrieNotMergeableException();
} else {
t.prepareForReading();
if (t.getRootNode() != null){
nodesToMerge.add((NodeWithValue<Integer>)t.getRootNode());
}