CodeGym /Courses /Java Collections /Big task: Create a URL shortener

Big task: Create a URL shortener

Java Collections
Level 6 , Lesson 15
Available

"Hi, Amigo!"

"Hello, Captain Squirrels, sir!"

"You have a new secret mission today. In order to encrypt correspondence between our units, you need to implement your own URL shortener service."

"Cool! Uhh, I mean, I am ready, sir. But why do we need this?"

"What do you mean why? Soldier, we're surrounded by enemies. We need to protect our lines of communication. Proceed to the task."

"Yes, sir! Implement a URL shortener service."

"Go to our secret agent IntelliJ IDEA. You'll receive all of the instructions there."

"It shall be done, Captain!"

"Proceed."

Big task: Create a URL shortener - 1
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (part 1)
Shortener (part 1)
9
Task
Java Collections, level 6, lesson 15
Locked
Shortener (part 2)
Shortener (part 2)
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (part 3)
Shortener (part 3)
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (4)
Shortener (4)
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (5)
Shortener (5)
32
Task
Java Collections, level 6, lesson 15
Locked
Shortener (6)
Shortener (6)
32
Task
Java Collections, level 6, lesson 15
Locked
Shortener (7)
Shortener (7)
32
Task
Java Collections, level 6, lesson 15
Locked
Shortener (8)
Shortener (8)
32
Task
Java Collections, level 6, lesson 15
Locked
Shortener (9)
Shortener (9)
32
Task
Java Collections, level 6, lesson 15
Locked
Shortener (10)
Shortener (10)
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (11)
Shortener (11)
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (12)
Shortener (12)
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (13)
Shortener (13)
32
Task
Java Collections, level 6, lesson 15
Locked
Shortener (14)
Shortener (14)
16
Task
Java Collections, level 6, lesson 15
Locked
Shortener (15)
Shortener (15)
9
Task
Java Collections, level 6, lesson 15
Locked
Shortener (16)
Shortener (16)
Comments (16)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Boat Level 40, Germany, Germany
15 May 2023
For part 3, the Requirements state that the field should be named LastID but this won't verify, it has to be LastId as the main Conditions state. Just some confusing inconsistency.
Justin Smith Level 41, Greenfield, USA, United States
28 December 2022
Part 4 doesn't say how long the random string should be. Isn't that an important piece of information, or is it up to us to arbitrarily decide how long? Also, this is another problematic example of "google the answer"... In this case, googling exactly as they say returns results that don't even use the BigInteger class, so it's not helpful. Here are results I get when searching for this. https://www.baeldung.com/java-random-string https://stackoverflow.com/questions/20536566/creating-a-random-string-with-a-z-and-0-9-in-java https://www.geeksforgeeks.org/generate-random-string-of-given-size-in-java/ Since I'm not really sure how BigInteger would play a role in solving this, and the google results aren't helping, I'm going to press forward on a solution without BigInteger and see if it passes. Hopefully it's not one of the tasks that specifically checks for a certain class. I'm also just going to assume a length of 25, since it doesn't say. EDIT: My solution seems to work, but I can confirm that it won't pass validation unless you use BigInteger. The validation page unfortunately says "use your favorite search engine" but the search results don't use BigInteger. Thankfully, the validation page also essentially provides the solution they want. The we come to part 8, where I can see other people have also had a lot of problems. Part of the problem with this one is that they say that if you don't know what the methods should do, look up the corresponding methods for HashMap. But HashMap doesn't have any of those methods we're adding, so I'm not really sure what they are talking about. I worked on this on my own for a while and I figured I would do what I can and then use the solution for methods where I didn't even know what they were looking for. When I got to that point, I found that all of my work was very far off from what they were asking for. Found this part very discouraging, overall.
Alex Buyanov Level 47, Netherlands
14 October 2022
For part 14 (with JUnit tests), your support method testStrategy() MUST be public, or verification will fail. Though in the real world, I would have personally prefer to make all "helper" methods private... Also, for JUnit itself it does not matter.
Lisa Level 41
25 January 2022
part 8, here it starts that I say: boahh... this is really insane. I mentioned it before that I implemented already a lot of data structures including my own hash set. So I know how this is working (should work... in theory). However without any hint what the to implement methods should do this is haaaaarddd. Reaaaaalllly haaaard. Have just passed part 8 and now feel the need to share this. hihihi, now I've read part 9 requirements, getting interesting, too ohh, if your're German, than this is excellent study material from the HdM Stuttgart. Take a timeout for approx 3-4 weeks, watch the vids and code all the data structures he's talking of. Then you're prepared for this task. lil update: 9 and 10 are OK if you managed to code 8 and if you're fit with Files and Path classes (nio).
TheLordJackMC Level 39, Princeton, idk somewhere
12 August 2021
"almost impossible" they said
Andrei Level 41
23 July 2021
Not gonna lie, from about Task 9-10 I started copy pasting the solution... No background information, no prior explanations, just 'google' and expect me to solve only difficult tasks on my own. Sure buddy.
MaGaby2280 Level 41, Guatemala City, Guatemala
6 July 2021
Read more on Wikipedia ... lol Don´t give up... al repositories needed are in Maven
BlueJavaBanana Level 37
9 April 2021
Norbert Level 41, Kielce, Poland
28 November 2022
I think the easier way is open Project Structure, then choose libraries, then click in the upper left corner '+' click from maven, write there guava and choose it, click OK.
25 June 2020
This task is madness )
BlueJavaBanana Level 37
8 April 2021
Yep another CodeGym classic. Here is a simple lesson on lists that a child could understand. Now read through the 3000 lines of professional Java source code for the HashMap and make your own versions! Need help? Type in "HashMap" in google. I do get frustrated when we are given really simple lessons followed by tasks that are extremely difficult.
Tom Level 41, San Jose, Sweden
7 June 2021
But definitily we learn a lot!
yz Level 37, Jakarta, Indonesia
16 April 2020
for 7th task: Create Entry class; dont create OurHashMap.... class and inside the class make Entry class ...
BlueJavaBanana Level 37
7 April 2021
Helpful tip! The entry class should not be nested!