What is the use of the Holder class in a HashMap?

I found that in HashMapwe have an inner class Holderwith the following description:

/**
 * holds values which can't be initialized until after VM is booted.
 */

How and when should we use this class? what is its use. Explain, please.

+4
source share
1 answer

This is due to enhancements to Java 7u6 and is removed in Java 8.


Relevant documentation:

Collection Extensions in Java SE 7

An alternative hash function improves the performance of these implementation maps when a large number of key hash collisions occur.

For Java SE 7u6, this alternative hash function is implemented as follows:

- . -1. -. -, jdk.map.althashing.threshold . 512. 512 512 -. 0, -.

...

Java SE 8

- String, 7u6, JDK 8, jdk.map.althashing.threshold. -, , .


, :

?

, ? - , . Oracle HashMap, . - jdk.map.althashing.threshold.

Oracle ? - . VM , , . , / , / .

, VM. , sun.misc.VM.isBooted().

+7

Source: https://habr.com/ru/post/1585109/


All Articles