There are three kinds of actuaries: those who can count, and those who can't.
What is more, I suspect there is a much simpler solution than anything they mentioned on that SO link.Dalvir Singh Bains wrote:. . .. . .
I meant a simpler version than the code shown above; one person showed two better solutions still, avoiding the intermediate Map.A few minutes ago, I wrote:. . . a much simpler solution . . .
There are three kinds of actuaries: those who can count, and those who can't.
That means the exact implementation of the unmodifiable Map might change in future.• The iteration order of mappings is unspecified and is subject to change.
The concept problem I saw earlier is that a linked map is intended to give iteration order the same as insertion order, but a tree map gives iteration order according to a value (as specified by the Comparator used to populate it)
Dalvir Singh Bains wrote:2. Due to unspecified iteration order, map generated at line 4 in my refactored example has unspecified order. It just happens to be in a consistent order after multiple runs in this example( by chance) at line 5 but that is just co-incidence. Nothing can be said definitely. As it's behavior may change when generated using a large data set. Here, initial data set of 7 items is not enough to deduce anything conclusively.
To cntinue from what Carey says, the order is unpredictable, but is consistent as long as the same implementation is used.Dalvir Singh Bains wrote:. . . map . . . just happens to be in a consistent order . . . by chance . . .
That's a pleasure By value I meant the “V” of the Map, which in this case happens to be a Long.Thanks for your insights on this post @Campbell.
That's apleasureDalvir Singh Bains wrote:. . . . Thanks @Carey and @Campbell.
Yes, you will learn some of the API by coding, but that is usually not enough to pass a cert. exam. I recommend you read the documentation for all the methods you are using. and those methods you expect to come up in he exam.. . . using API . . . help to recall API faster and it kinda builds muscle memory. . . .
. . , swimming, like it can only be learned by jumping in the pool. . . .
There are three kinds of actuaries: those who can count, and those who can't.
Agree. Have another cowPiet Souris wrote:. . . for your very interesting topic . . . have a cow! . . .
I gave it on your thread about varargs.A minute or two ago, I wrote:. . . Have another cow
As an extra exercise: from the frequencyMap, can you create a datastructure that gives, when printed,
{3=[apple], 2=[pear], 1=[papaya, orange, banana]}
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:
There are three kinds of actuaries: those who can count, and those who can't.
Perhaps it might be of interest to see whether these new things would simplify the questions being discussed here.JEP 461 wrote:Stream::gather(Gatherer) is to intermediate operations what Stream::collect(Collector) is to terminal operations.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:I do not understand the necessity of a LinkedHashMap anyway.
My, my, aren't you a big fella. Here, have a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|