private static boolean hasNonEmptyGroups(MultiMap<FileType, PsiFile> filesByType) {
    long nonEmptyGroups = filesByType.entrySet().stream().map(Map.Entry::getValue)
      .filter(files -> files != null && !files.isEmpty()).limit(2).count();
    return nonEmptyGroups > 1;
  }
private static boolean hasNonEmptyGroups(MultiMap<FileType, PsiFile> filesByType)