Fast and constant get () mapping with Java 7

When using the HashMap provided by Java 7, I encountered a problem, that is, get() evolved from O (1) to o (n), as described here and solved in Java 8

But because I have to stick to Java 7 and can't upgrade the project, I'm looking for a library or any way to get a fast and constant get()

Solution

The nature of change in Java 8:

Link from you performance improvement for HashMap in Java 8

You can achieve equivalence by improving the hashcode implementation to reduce the number of conflicting keys

Without the details of hashcode calculation or the mode of value, it is difficult to make further suggestions

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>