Shortener (6)

  • 32
  • Locked
The first strategy is ready. It's time to test it. To do this: 6.1. Create a Solution class if you haven't already done so. 6.2. Add implementations of the static helper methods to the Solution class: 6.2.1. Set<Long> getIds(Shortener shortener, Set<String> strings).
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 38 , Greenfield, USA, United States
30 December 2022, 17:20
Passed this one on the first try, couldn't believe it! The main reason this task is difficult is due to poor clarity in the instructions. For example: "6.2.3.2. Generate a test set using Helper and the specified number of elements (elementsNumber)." This means you are going to create a HashSet object containing elementsNumber (10,000 in this case) randomly generated strings according to the methods available. Then you are going to add each of these to the StorageStrategy. The point of this task is to then use the getIds method with the HashSet of randomly generated strings, and then use that HashSet of Longs with the getStrings method to get back the HashSet of strings. Then you check that they match with the original set of Strings. It's to make sure that the data isn't somehow getting corrupted or altered in the process of adding and retrieving values from the StorageStrategy. I think they also want to show you that there is a tremendous difference in time spent between getting a list of keys and getting a list of values, which you should notice if you do the task correctly.