Beware of simply searching for an answer. You don't know whether what you find will be really good or really bad. You also won't learn anything from it. Please also tell us where you found it, so we can evaluate the original.
Gurtej Grewal wrote:This is just an example from google . . .
Only just. I think it is iterating the key set twice and you should be able to find the maxima along with they keys in one pass through the key set.
Piet Souris wrote:That code worked . . .
That looks exactly like what I was thinking of.
Carey Brown wrote:Example without using Streams. . . .