Why define object for getEntry in HashMap

后端 未结 4 930
盖世英雄少女心
盖世英雄少女心 2020-12-21 20:56

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

4条回答
  •  天涯浪人
    2020-12-21 21:39

    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.

提交回复
热议问题