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.
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
Simon Ritchie wrote:I'm finding much of it difficult to follow as I'm not anywhere near proficient on streams or lambdas but it's given me something to work on.
Liutauras Vilda wrote:
Simon Ritchie wrote:I was looking at the Collectors API for the toMap() method but I can't see an example there that takes four parameters.
"Get every key and value in this Map, then map the key value onto a parameter called k, then return the results in a LinkedHashMap object"
Carey Brown wrote:I took your various solutions, along with my non-Java8 version, and I'm getting inconsistent results. ...
Re-reading the OP's post:Liutauras Vilda wrote:Because I retrieve nth frequency (value) instead of the key. You can verify that by looking to my answer, which is the frequency of 4.
There are three kinds of actuaries: those who can count, and those who can't.
Carey Brown wrote:He says "element" not frequency. I take that to mean the key not the value.
salvin francis wrote:To get the 4th rarest, I guess it would have to be sorted as per occurrence rate ascending:
1=1, -> 1st (most) rarest
5=1, -> 2nd rarest
3=3, -> 3rd rarest
6=3, -> 4th rarest
7=4, -> 5th rarest
2=5, -> 6th rarest
4=5 -> 7th (least) rarest
salvin francis wrote:There's a tiny bug in the code...
Liutauras Vilda wrote:salvin, I like how we programmers are so protective about our code.
Lookout! Runaway whale! Hide behind this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|