I have:
Path path = Paths.get("Foo.class");
Path path2 = Paths.get("Foo.java");
FileSystem fs = FileSystems.getDefault();
PathMatcher matcher = fs.getPathMatcher("glob:*.{class, java}");
matcher.matches(path); // TRUE
matcher.matches(path_2); // FALSE
Why path2 is false if the glob syntax {} means that it matches .class or .java?
From jdk documentation:
*.{java,class} Matches file names ending with .java or .class
It is because of the space in
class, java