On Wednesday 10:20 am I will present "Observing Project Valhalla" at BED-CON in Berlin. The organizers assembled a really interesting program this year: https://bed-con.org/2026/programm. Hope to see some of you there!
Cay Horstmann
In my copious spare time I write books and develop online courses for beginning and professional programmers.
Are you using Anki flashcards? Do you ❤️ its open source awesomeness? If so, consider donating through the app right now. Google is apparently making them remove the donation link in the next update. https://github.com/ankidroid/Anki-Android/issues/21656
Why not allow special characters and longish file names in a contact form? Making it difficult to do something easy is a German specialty. We call it the Korinthenkacker (raisin shitters). And apparently the IT outsourcing providers support it as a service when bidding on German jobs.
I just got back from the JavaZone conference in Oslo. It was a lot of fun--highly recommended. All videos: https://vimeo.com/javazone My video: https://vimeo.com/1223388783 My slides: https://horstmann.com/presentations/2026/javazone/
On Wednesday October 14 I will present a workshop on using Java for small programming tasks at Basel One (https://baselone.org/#programm). I invite you bring your own tasks, or learn from some of mine. Hope to see some of you there!
1/2 Now that Valhalla is in mainline (https://jdk.java.net/28/), let's see what it can do:
$ cat Ids.java
value record Id(int value) {}
public class Ids {
void main() throws Exception {
var ids = new Id[100_000_000];
for (int i = 0; i < ids.length; i++) ids[i] = new Id(i);
IO.println(ids);
Thread.sleep(10000);
}
}
$ javac --enable-preview --source 28 Ids.java
$ java --enable-preview Ids && (jcmd Ids GC.class_histogram | head)
Valhalla has arrived in mainline Java (build 28-ea+10-569): https://jdk.java.net/28/
$ cat Points.java
value record Point(double x, double y) {
public Point moveBy(double dx, double dy) {
return new Point(x + dx, y + dy);
}
}
void main() {
var p = new Point(0, 0);
for (int i = 0; i < 100_000_000; i++) {
p = p.moveBy(Math.random() - 0.5, Math.random() - 0.5);
}
IO.println(p);
}
$ java --enable-preview Points.java
Why my chagrin with German web sites? In a contact form, I tried to explain a problem with another form of the provider. And typed in their URL. Oh noes. Special characters are not allowed! So I had to spell out https Doppelpunkt Schrägstrich Schrägstrich etc. And I tried to attach the PDF they sent me. It was not to be. File name (their choice, Leuchtenberger Kirchweg47B_20260908_Unser\ Angebot_VK20102356538.pdf) more than 50 characters.
Who would have thought—a documentary about Java. Pretty cool. Watch it at https://www.youtube.com/watch?v=ZqGSg4b_cZA
The Java Story | The Official Documentary
Github gives you until April 24 to opt out of using your Copilot interactions for model training. The setting is at the bottom of https://github.com/settings/copilot/features: Allow GitHub to use my data for AI model training.
2/2 Here the histogram:
num #instances #bytes class name (module)
-------------------------------------------------------
1: 1 800000016 [LId;
2: 8841 356272 [B (java.base@28-ea)
3: 1732 229232 java.lang.Class (java.base@28-ea)
* No individual Id objects
* A flat array of Id objects
* Why 8 bytes per element?
* Each Id is 4 bytes
* Another byte for a nullness indicator
* And 3 bytes padding
Valhalla has arrived
Interesting issue about Java Valhalla performance: https://mail.openjdk.org/archives/list/valhalla-dev@openjdk.org/thread/3P5463B2OWURWM4LIMYIQMQOMZCOR6LN, details at this nice blog: https://johan-sjolen.github.io/post/compiler-sympathy/compiler-sympathy
At Basel One, I will present a workshop on Java for small coding tasks on October 14 and a deep dive into Java streams internals on October 15. This is one of my favorite conferences for networking. Hope to see you there! More at https://baselone.org
PSA about white space in modern Java. Character::isWhitespace and String::strip are aligned. Stay away from legacy Character::isSpace and String::trim. But the regex "(?U)\\s" differs in eight code points: 28, 29, 30, 31, (Information separator 4...1) pass isWhiteSpace and not \s. Conversely, 133 (Next line), 160 (No-break space ⚠), 8199 (Figure space), 8239 (Narrow no-break space) don't pass isWhiteSpace but match \s.
I just finished my talk at JCON—When Greed is Good: Understanding Java Stream Performance. The title attracted a good crowd. Slides at
Is there any AI software that can watch a boring compliance video (emergency procedures, nondiscrimination, hazard communication, etc.) and answer the multiple choice questions that check for comprehension? Asking for a friend...
My article "Effective Pattern Matching 2026 Edition" is now live at https://javapro.io/2026/03/24/effective-pattern-matching-2026-edition/
I never thought much about hash codes of Java enumeration constants, but https://4comprehension.com/enum-map-serialization/ set me straight. Turns out enum hash codes are not stable, so serializing them as map keys will not work. Remedy: EnumMap!
At JCON, a speaker's slides had a mysterious reference to "danger to the herd". My preferred search engine (Kagi) led me to https://www.reddit.com/r/ProgrammerHumor/comments/azubgl/kantega_the_mysterious_life_of_developers/ I had a good laugh at the "cliché developer with a conference t-shirt". Guilty as charged.
One of my posts in this sequence did not succeed on BlueSky: Invalid app.bsky.feed.post record: grapheme too big (maximum 300, got 443). Raisin shitting is not limited to Germany...
After a day of interacting with German web sites, I am reminded of Hanlon's razor (https://en.wikipedia.org/wiki/Hanlon%27s_razor): "Never attribute to malice that which is adequately explained by stupidity." Or it's corollary, Grey's law: "Any sufficiently advanced incompetence is indistinguishable from malice."
