Tim Driven Development | Test until the fear goes away
There are three kinds of actuaries: those who can count, and those who can't.
Just the String value of some Map key and the String value of one of the Map value Set.Stephan van Hulst wrote:
Do you need an entry, or is just the value also okay?
No. The map mustn't change.Stephan van Hulst wrote:
If an entry, do changes to it need to be reflected in the map?
NoStephan van Hulst wrote:
Are entries ever removed from the map?
Yes, any you choose.Stephan van Hulst wrote:
Can we depend on a specific map implementation?
Tim Driven Development | Test until the fear goes away
Stephan van Hulst wrote:It has the same properties as a LinkedHashMap because it's based on one, including the time and space complexities of all methods.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Stephan van Hulst wrote:In most solutions the core idea is to use a separate list of keys. I guess the preferred solution depends on whether speed or memory usage is more important (...)
There are three kinds of actuaries: those who can count, and those who can't.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Carey Brown wrote:Using the randomKeyIndex you have a roughly 1 in 2 chance of selecting either "Gp1" or "Grp2". So let's say it's Grp1, then with randomValueIndex each String in the list has a 1 in 10 chance of being selected, which gives us a 1 in 20 chance that selection "a" would be chosen. Conversely, If Grp2 is selected there's a 1 in 1 chance that "K" will be chosen, or 1 in 2 overall chance. This means that the random distribution over all items in all the lists would not be equal.
Absolutely! Distribute your cows as you wish. The solutions are cool.Henry wrote:Can we also give out cows too? Some of the solutions are cool
Ah sorry Jeanne, my sample data does suggest that but it's not representative in that way. Each key can have one to many values.Jeanne wrote:I assumed the sample data was represented and each key had the same number of values.
Tim Driven Development | Test until the fear goes away
Tim Driven Development | Test until the fear goes away
""By reassembling the pieces we get:
(1 until n) flatMap (i =>
(1 until i) map (j => (i, j)))
filter ( pair => isPrime(pair._1 + pair._2)
)
This works, but makes most people's head hurt. Is there a simpler way?
There are three kinds of actuaries: those who can count, and those who can't.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |