About Question enthuware.ocpjp.v7.2.1212 :
Moderator: admin
-
- Posts: 1
- Joined: Wed Oct 09, 2013 10:12 pm
- Contact:
About Question enthuware.ocpjp.v7.2.1212 :
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
Thanks
-
- Posts: 3
- Joined: Fri Jan 24, 2014 6:37 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1212 :
Curious about this one too.
-
- Site Admin
- Posts: 10064
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1212 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 3
- Joined: Fri Jan 24, 2014 6:37 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1212 :
Cheers, thanks for your explanation.
-
- Posts: 22
- Joined: Mon Jul 06, 2015 11:45 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1212 :
But how can we say it will cross directory or not by looking at walkFileTree method ? what is essence in this question?
-
- Site Admin
- Posts: 10064
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1212 :
We can say that by go through the JavaDoc API description of walkFileTree method.
If you like our products and services, please help us by posting your review here.
-
- Posts: 9
- Joined: Tue Apr 17, 2018 5:03 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1212 :
What is the difference between Files.walk() and Files.walkFileTree() methods?
Thanks in advance.
Thanks in advance.
-
- Site Admin
- Posts: 10064
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1212 :
Check out the JavaDoc of both:
https://docs.oracle.com/javase/8/docs/a ... isitOption...-
and
https://docs.oracle.com/javase/8/docs/a ... leVisitor-
https://docs.oracle.com/javase/8/docs/a ... isitOption...-
and
https://docs.oracle.com/javase/8/docs/a ... leVisitor-
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 114 guests