While using the HashMap that java 7 provides, i ran into the problem that get() evolves 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 am looking for a library or any way to have a Map with a fast and constant get().
The essence of the change in Java 8:
From your link Performance Improvement for HashMap in Java 8
Buckets containing a large number of colliding keys will store their entries in a balanced tree instead of a linked list after certain threshold is reached.
You could achieve the equivalent by reducing the number of colliding keys by improving your hashCode
implementation.
Without details of your hashCode
calculation or the pattern of the values it is difficult to advise further.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With