public void mergeFunctions(FunctionTagLib c, Change children) { Map<Object, ELFunction> functionMap = new HashMap<Object, ELFunction>(); for (IELFunction f : getFunctions()) functionMap.put(((KbObject) f).getId(), (ELFunction) f); for (IELFunction f : c.getFunctions()) { ELFunction loaded = (ELFunction) f; ELFunction current = functionMap.get(loaded.getId()); if (current == null) { addFunction(loaded); Change change = new Change(this, null, null, loaded); children.addChildren(Change.addChange(null, change)); } else { List<Change> rc = current.merge(loaded); if (rc != null) children.addChildren(rc); } } for (ELFunction f : functionMap.values()) { ELFunction removed = f; synchronized (functions) { if (functions.contains(removed)) { continue; } functions.remove(removed.getName()); functionArray = null; } Change change = new Change(this, null, removed, null); children.addChildren(Change.addChange(null, change)); } }