Page 1 of 1

About Question enthuware.ocpjp.v7.2.1212 :

Posted: Wed Oct 09, 2013 10:15 pm
by cesarnda
This question should give a little more details about why the answer is 4. For what I have understand, the expression "glob:*.java" will not cross directories, so it will only match the file a.java. If we want to match all of the files in the sub directories, we should use "glob:**.java".


Thanks

Re: About Question enthuware.ocpjp.v7.2.1212 :

Posted: Sun Feb 02, 2014 2:35 pm
by Damo2k
Curious about this one too.

Re: About Question enthuware.ocpjp.v7.2.1212 :

Posted: Sun Feb 02, 2014 9:46 pm
by admin
It is not the glob pattern that is making it cross the directories. It is the Files.walkFileTree method that makes it travel each level under the given path. The glob pattern only matches *.java in the same directory.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1212 :

Posted: Mon Feb 03, 2014 4:24 am
by Damo2k
Cheers, thanks for your explanation.

Re: About Question enthuware.ocpjp.v7.2.1212 :

Posted: Thu Dec 10, 2015 5:44 am
by fariz.siracli
But how can we say it will cross directory or not by looking at walkFileTree method ? what is essence in this question?

Re: About Question enthuware.ocpjp.v7.2.1212 :

Posted: Thu Dec 10, 2015 5:51 am
by admin
We can say that by go through the JavaDoc API description of walkFileTree method.

Re: About Question enthuware.ocpjp.v7.2.1212 :

Posted: Sat Apr 21, 2018 10:46 am
by jabenitez
What is the difference between Files.walk() and Files.walkFileTree() methods?

Thanks in advance.

Re: About Question enthuware.ocpjp.v7.2.1212 :

Posted: Sat Apr 21, 2018 8:40 pm
by admin