Building a file

  • 20
  • Locked
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
You can't complete this task, because you're not signed in.
Comments (14)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Олег Байбула
Level 32 , Ukraine
Expert
20 February, 13:21
Why Comparator if it perfectly works with noargs TreeSet constructor?)
Jomar Tayactac
Level 2 , Winnipeg, Canada
Expert
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.
Mike S
Level 26 , Saint Louis, United States
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?
Олег Байбула
Level 32 , Ukraine
Expert
20 February, 13:22
I made it fast and without checking on ".part" containing, maybe you did something wrong?
Justin Smith
Level 38 , Greenfield, USA, United States
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?
Roman
Level 41
8 October 2021, 06:59
Олег Байбула
Level 32 , Ukraine
Expert
20 February, 13:18
And read about functional programming, btw.))
Jurij Thmsn
Level 29 , Flensburg, Germany
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
Isma
Level 41 , Madrid, Spain
30 December 2020, 08:39
Okay mates, don't f***** miss the point in ".<partN>".
Andrei
Level 41
28 January 2021, 15:07
lol, thanks!
MoJo
Level 22 , Cairns, Australia
16 December 2020, 12:02
Do not add a new line or anything between the files, even if it looks weird when testing.
Switch/Cypher
Level 25 , Bexleyheath, United Kingdom
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"
Mateusz
Level 29 , Poland
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.
Adrian
Level 27 , Spanish Town, Jamaica
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.