Some countries have integer numbers printed on the transport tickets, for example, in ex-USSR. The ticket is "happy" when the sum of the first half of digits equals to the second one. Then you should eat it and make a wish.
123456 and 111222 are not happy tickets
123123 and 123222 are the happy tickets
In theory, hash map structure should be very fast on retrieving by key operations, close to O(1) like for an array. A sorted map (keys are sorted) should be O(log2 N) instead. The following test checks the difference.
We will use one tester class per type of tested structure. The keys are string and are generated randomly in prepared array to avoid additional checks whether the key exists or not.