Lazy Constants (JEP 531): JIT’s Best Friend You Haven’t Met (opens in new tab)
How ofLazy() unlocks constant-folding without static final, why it finally replaces double-checked locking, and what the numbers look like in practice. Every Java developer knows the tension. You want a value to be immutable so the JIT can inline it, skip null checks, and apply constant-folding — but you also want it to initialize lazily, not at class-load time. …
Read the original article