Java 25 includes Stable Values, a preview API for holding a value that can be initialized later but set only once. Oracle says the JVM can treat an assigned stable value like a constant for optimization, while allowing more flexible initialization timing than a final field. The API is not final: using it requires preview features to be enabled, and its design may change in a later Java release.
What are stable values in Java 25?
StableValue<T> is a holder for a value that can start unset and then be assigned at most once. After assignment, the holder cannot be used to replace its contents. Oracle describes the API as shallowly immutable: the holder’s reference or value cannot be replaced through the holder, but this does not make an object stored in it deeply immutable.
The intended use is a value that is costly or inconvenient to initialize immediately, yet should not change once it has been established. Oracle’s stated rationale is that the JVM may treat stable values as constants and apply the same performance optimizations as for a final field. This is a design claim, not a quantified benchmark result; performance depends on the program and workload.
See Oracle’s Java SE 25 StableValue API documentation for the exact method contracts.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
How do I use StableValue?
Create a holder with StableValue.of(). It begins unset. The API offers methods for attempting to set it, requiring a successful set, or computing and setting a value only if one is absent:
trySet(value)attempts to set the value, without throwing if it cannot set it.setOrThrow(value)sets the value or throws if the holder has already been set.orElseSet(supplier)obtains and sets a value if the holder is unset; if already set, it uses the existing value.
For retrieval, the API includes orElseThrow() when a value must be present, orElse(fallback) when a fallback is suitable, and orElseSet(supplier) when retrieval should initialize an unset holder. Consult the API documentation for precise behavior, exceptions, and concurrency semantics before choosing a method.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
StableValue vs. a final field
| Consideration | final field |
StableValue in JDK 25 |
|---|---|---|
| Initialization timing | Must be assigned as part of field initialization or construction. | Can be created unset and assigned later. |
| Changing the held value | Cannot be reassigned after initialization. | Can be set at most once through the holder; it cannot later replace the held value. |
| JVM optimization intent | Final fields are the stated comparison for constant-like optimization. | Oracle says the JVM can treat stable values as constants and enable the same performance optimizations; no numeric improvement is established. |
| Maturity and deployment | Established Java language feature; no preview flag is needed for the field itself. | Preview API in Java 25; preview features must be enabled, and the API may change, be removed, or become permanent in a later release. |
The choice is primarily about initialization design, not a guaranteed speedup. A final field remains straightforward when construction can supply the value. A stable holder is relevant when initialization needs to happen later; benchmark the actual workload before drawing performance conclusions.
Is JEP 502 final or preview?
JEP 502 Stable Values is a preview feature in Java 25, not a finalized platform API. Programs that use it must enable preview features. Oracle’s Java SE 25 preview list describes the preview status; preview features may be removed in a future release or upgraded to permanent platform features.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
That status matters for compatibility. Teams considering use should account for preview-enabled builds and runtime configuration, then retest and review migration requirements when moving to a later Java release. Do not treat code that compiles against JDK 25 as proof that the API will remain unchanged.
What else is notable in JDK 25?
Oracle announced Java 25 on September 16, 2025. The release also highlighted changes across the language, libraries, runtime, and security. Their maturity differs, so not every item below has the same status as Stable Values.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
- Language: module import declarations; compact source files and instance main methods; flexible constructor bodies; and primitive types in patterns,
instanceof, andswitch(preview). - Libraries: scoped values and key derivation functions; the Vector API is an incubator feature, while PEM encodings are preview.
- Runtime and performance: compact object headers and ahead-of-time improvements.
Oracle’s Java 25 announcement and JDK 25 migration notes provide release context and migration details.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Which JDK 25 update should I use?
Java 25 is a release line, not a single frozen build. Oracle’s consolidated JDK 25 release notes list JDK 25.0.4.1 GA, version 25.0.4.1+1, released August 18, 2026, and recommend keeping JDK installations current with Critical Patch Updates. Check Oracle’s release notes for a newer update before installing or upgrading; the listed update and date can change.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

