undefined

Practice using File

Java Collections
Level 1 , Lesson 2
Available

"Hi, Amigo! I came up with a couple of interesting tasks for you."

"They can only be completed in IntelliJ IDEA. Take a look at these interesting conditions…"

undefined
28
Task
Java Collections, level 1, lesson 2
Locked
Iterating through a file tree
1. The main method is passed two arguments as inputs. The first argument is path, which is the path to the directory; the second is resultFileAbsolutePath, which is the name (full path) of an existing file that will store the result.
undefined
14
Task
Java Collections, level 1, lesson 2
Locked
Find all the files
Implement the getFileTree method, which must create a list of all of the files, including nested files. Use a queue. Don't use recursion. Return a list of the paths to all the found files. Don't return paths to directories. The path must be absolute.
undefined
28
Task
Java Collections, level 1, lesson 2
Locked
Advanced file search
Let's implement a configurable file search within a directory. Look over the java.nio.file.FileVisitor interface and its superclass's implementation java.nio.file.SimpleFileVisitor.
Comments (9)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Rom Level 25 Paris France
5 March 2021
Advanced file search Only 184 students passed it ! 😱
Isma Level 31 Madrid Spain
12 February 2021
Advanced file search: Do not use FileInputStream, path.toFile() or any class/method from io packages. Only allowed nio packages. Hint: FileChannel class Don't miss the CodeGym's solution after completing this task, it's worth it.
LennyMan Level 25 Lucca Italy
13 January 2021
Here, how to iterate through a File Tree: https://stackoverflow.com/questions/3154488/how-do-i-iterate-through-the-files-in-a-directory-in-java Very clear
SOUFIANE DAHIMI Level 32 Marrakech Morocco
2 May 2020
Seb Level 41 Crefeld Germany
14 February 2020
Hint for "Advanced file search": If several search criteria is given, find files that fulfill all criteria. Do not search for files that fulfill only parts of the given criteria.
12 November 2019
I'd appreciate some help to solve "Advanced file search." Can't get past through the last condition :/
kareandr Level 35 Podol'sk Russian Federation
12 July 2019
If you cant solve "Iterating through a file tree", try to solve "Find all the files" first. If I knew about queues earlier. it wouldnt be so painfull (: PS. Solved it with ArrayList, but OMG, it was a long way. ConcurrentModificationException...
Ewerton Level 30 Belo Horizonte Brasil
8 July 2019
Find all the files: "Don't use recursion!" :(