Let's build a file from various pieces.
Read file names from the console.
Each file has a name: .partN. For example, Lion.avi.part1, Lion.avi.part2, ..., Lion.avi.part37.
The file names are supplied in random order. The word "end" is used to stop reading in file names.
In the folder where
Building a file
- 20
Locked
Comments (14)
- Popular
- New
- Old
You must be signed in to leave a comment
Олег БайбулаExpert
20 February, 13:21
Why Comparator if it perfectly works with noargs TreeSet constructor?)
0
Jomar TayactacExpert
27 January 2022, 14:03
Couldn't get this task passed until I put a check on whether the file contains the word ".part" in it. I'd assumed that all files read from the console would automatically have the ".part" in the name but I guess not.
0
Mike S
13 February, 18:46
This exercise is worded so goofily. I'm just now realizing the part of ordering the input streams. How are we supposed to order it if there's no ".part" attached?
0
Олег БайбулаExpert
20 February, 13:22
I made it fast and without checking on ".part" containing, maybe you did something wrong?
0
Justin Smith
7 October 2021, 02:14
I solved this in only 2 tries, which I was really surprised by because while I was working on it I was convinced this was the hardest task yet, but then I looked at the solution to see how it was different from my code and felt bad because it has a lot in it that I don't understand. For example, why are they overriding a compare method when they don't even call the method at all in the rest of the code?
0
Roman
8 October 2021, 06:59
Read about Аnonymous Сlasses
0
Олег БайбулаExpert
20 February, 13:18
And read about functional programming, btw.))
0
Jurij Thmsn
14 April 2021, 14:18
Easier than I thought.
One thing I misunderstood first: The filenames are entered line by line in the console, not with a comma like it is written in the example.
like:
/Users/test/Desktop/Folder/Lion.avi.part1
/Users/test/Desktop/Folder/Lion.avi.part2
...
end
0
Isma
30 December 2020, 08:39
Okay mates, don't f***** miss the point in ".<partN>".
+1
Andrei
28 January 2021, 15:07
lol, thanks!
0
MoJo
16 December 2020, 12:02
Do not add a new line or anything between the files, even if it looks weird when testing.
0
Switch/Cypher
7 October 2020, 18:41
"For example, Lion.avi."
The dot at the end of this is a FULL STOP, not part of the filename that you need.
The Filename should just be "Lion.avi"
+2
Mateusz
14 September 2020, 21:32
If you have problems soloving this task, think carefully if you really need to use the "append" function when outputting.
0
Adrian
24 August 2020, 03:54
This drove me insane, i think codegym needs to declare in the conditions which classes aren't allowed. for anyone else wondering, for some reason the vallidator does not want you to use the Java.io.File class, or at least some of the methods therein, i went mad trying to figure out why the output of my code was correct but it kept insisting i didn't close streams. whew.
0