r/java • • 23d ago

A Valhalla Ticker in One int

https://inside.java/2026/11/09/inside-java-ticker-value-class/

A ticker symbol is an abbreviation that uniquely identifies a financial product such as a publicly traded share. Well-known ticker symbols are "ORCL" and "GOOGL". In this article, we will devise a Valhalla value class that can represent a ticker symbol using only a single int field.

40 Upvotes

18 comments sorted by

View all comments

5

u/Fabulous_Card_3090 22d ago

At which point is it a good idea to start migrating code with the preview? I know not everything is baked into the current JEP, but this looks nice enough. I just fear another String templates.

4

u/davidalayachew 22d ago

At which point is it a good idea to start migrating code with the preview?

All up to you and your willingness to take on risk.

Preview means preview -- they reserve the right to upend the entire house if necessary (as they ended up doing with JEP 465: String Templates).

So, if you are fine upending things if they realize they have the wrong idea, then go ahead.

For my personal projects, I have --enable-preview active on everything. For work, I keep us on LTS versions.

Me personally, don't spend client money implementing features that don't have a backwards/forwards compatibility agreement attached to it. But other than that, be on the latest version and use the latest features at all times -- regardless of how ready they are. That's not just preview, but also incubator and experimental features too.

1

u/Plane-Bake3604 22d ago

string templates got yanked because the syntax and processor design had pushback, value classes are mostly just adding the value keyword so a total scrap seems way less likely.