MavenProjectNode (Collection<? extends MavenSimpleNode> nodes) { MavenProjectNode parent = null; for (MavenSimpleNode node : nodes) { var nextParent = node.findParentProjectNode(); if (parent == null) { parent = nextParent; } else if (parent != nextParent) { return null; } } return parent; }