PathMatcher (@NotNull Collection<String> fileMasks) { List<String> refinedFileMasks = ContainerUtil.map(fileMasks, fileMask -> StringUtil.trimStart(fileMask, "**/")); if (refinedFileMasks.size() == 1) { return FileSystems.getDefault().getPathMatcher("glob:" + ContainerUtil.getFirstItem(refinedFileMasks)); } if (refinedFileMasks.size() > 0) { return FileSystems.getDefault().getPathMatcher("glob:{" + StringUtil.join(refinedFileMasks, ",") + "}"); } return path -> false; }