cInfos.add(it.next());
}
// first make sure the ordering of all existing entries is ok
NodeEntry entry = null;
for (it = cInfos.iterator(); it.hasNext();) {
ChildInfo ci = (ChildInfo) it.next();
NodeEntry nextEntry = get(ci);
if (nextEntry != null) {
if (entry != null) {
reorder(entry, nextEntry);
}
entry = nextEntry;
}
}
// then insert the 'new' entries
List newEntries = new ArrayList();
for (it = cInfos.iterator(); it.hasNext();) {
ChildInfo ci = (ChildInfo) it.next();
NodeEntry beforeEntry = get(ci);
if (beforeEntry == null) {
NodeEntry ne = factory.createNodeEntry(parent, ci.getName(), ci.getUniqueID());
newEntries.add(ne);
} else {
// insert all new entries from the list BEFORE the existing
// 'nextEntry'. Then clear the list.
for (int i = 0; i < newEntries.size(); i++) {