boolean (Collection<MavenProject> mavenProjects) { Iterator<MavenProject> itr = mavenProjects.iterator(); if (!itr.hasNext()) return true; String groupId = itr.next().getMavenId().getGroupId(); while (itr.hasNext()) { MavenProject mavenProject = itr.next(); if (!Objects.equals(groupId, mavenProject.getMavenId().getGroupId())) { return false; } } return true; }