I am new to generics and I am not sure if the answer to my question is opinion based
or has a genuine reason. In the following code what was need to case a key
Looking at the code for Entry, key is "final". My take is that this code is creating a non-final variable from the final variable so that constraints of a final variable does not prevent the subsequent code from executing. Other than that, I also would assume as you have said both the "if" conditions should be the same.