boolean (List<CauseItem> children) { if (myChildren.isEmpty()) return false; if (myChildren.size() != 1 || !(myChildren.get(0).myProblem instanceof PossibleExecutionDfaProblemType)) { if (children.size() == myChildren.size()) { List<CauseItem> merged = StreamEx.zip(myChildren, children, CauseItem::merge).toList(); int nullPos = merged.indexOf(null); if (nullPos == -1) { myChildren.clear(); myChildren.addAll(merged); return true; } else if (merged.lastIndexOf(null) == nullPos) { CauseItem merge = new CauseItem(new PossibleExecutionDfaProblemType(), (PsiElement)null); merge.addChildren(myChildren.get(nullPos), children.get(nullPos)); myChildren.clear(); myChildren.addAll(merged); myChildren.set(nullPos, merge); return true; } } insertIntoHierarchy(new CauseItem(new PossibleExecutionDfaProblemType(), (PsiElement)null)); } CauseItem mergePoint = myChildren.get(0); if (children.isEmpty()) { ((PossibleExecutionDfaProblemType)mergePoint.myProblem).myComplete = false; } List<CauseItem> mergeChildren = mergePoint.myChildren; for (CauseItem child : children) { if (!mergeChildren.contains(child)) { boolean merged = false; for (int i = 0; i < mergeChildren.size(); i++) { CauseItem mergeChild = mergeChildren.get(i); CauseItem result = mergeChild.merge(child); if (result != null) { mergeChildren.set(i, result); merged = true; break; } } if (!merged) { mergeChildren.add(child); } } } return true; }