Summary
This API was first previewed in JDK 25 via JEP 502: Stable Values and then in JDK 26 via JEP 526 Lazy Constants. Based on experience and feedback, we propose to remove two methods from LazyConstant and add support for lazy sets.
Problem
The methods LazyConstant::isInitialized and LazyConstant::orElse could result in usages that were outside the design goals of the Lazy Constant API.
There was support for lazy lists and maps, but not for lazy sets.
Solution
-
Remove the
LazyConstant::isInitializedandLazyConstant::orElsemethods. -
Add a new factory method
Set::ofLazythat allows the creation of lazy sets.
Specification
See attachment.
- csr of
-
JDK-8376811 Implement JEP 8376595: Lazy Constants (Third Preview)
-
- New
-