TAG · 9 ARTICLES

#modern-java

Modern Java

  1. JAVAJava 21 features for AI apps: records, sealed types and moreLLM code has three hard parts: messy JSON, replies that come in many shapes, and calls that take seconds. Modern Java has a feature for each. Here is how records, sealed types, pattern matching, text blocks and virtual threads fit AI work.17 Nov 2026 · 8 min
  2. JAVAJava 21 features: what's new in Java 21 LTS, with examplesJava 21 is the long-term-support release that made virtual threads, record patterns, pattern matching for switch and sequenced collections standard. Here is every important feature, what each one does in a line of code, which were only previews, and what to watch when you upgrade from Java 17.16 Nov 2026 · 7 min
  3. JAVAJava 21 virtual threads explained: before and afterFor more than two decades every Java thread was glued to an operating-system thread, and a thread waiting on a database held that OS thread hostage. Virtual threads cut the glue. Here is the old model, the problem it caused, and exactly what virtual threads fix.16 Nov 2026 · 9 min
  4. JAVAPattern matching for switch in Java 21, with examplesJava 21 lets switch match on types, not just constants. Here is how it replaces the old if-instanceof-cast ladder, how when guards and case null work, the dominance and exhaustiveness rules, and how record patterns unpack data right in the case label.16 Nov 2026 · 4 min
  5. JAVAJava records explained: one-line data classes, with examplesOne line replaces a 40-line data class. Here is what a Java record gives you for free, how to add validation and methods, where records fit, where they don't, and what Java 21's record patterns add.16 Nov 2026 · 5 min
  6. JAVAJava sealed classes and interfaces explained, with examplesA sealed class says exactly which classes may extend it, and the compiler enforces the list. Here is why that matters, the rules for permits, final, sealed and non-sealed, and how sealed types plus records give you switch statements the compiler can check.16 Nov 2026 · 5 min
  7. JAVAJava 21 sequenced collections: getFirst, getLast, reversedFor years, getting the last element of a List meant list.get(list.size() - 1), and a LinkedHashSet couldn't do it at all. Java 21 adds one shared set of methods to every ordered collection. Here is what's new, which classes have it, and the traps to avoid.16 Nov 2026 · 4 min
  8. JAVAJava text blocks explained: multiline strings in JavaText blocks let you write JSON, SQL, HTML and LLM prompts in Java exactly as they look, without escaped quotes or \n on every line. Here is the syntax, how Java decides what indentation to keep, the two escapes worth knowing, and how to fill in values.16 Nov 2026 · 5 min
  9. JAVAJava var explained: local variable type inferencevar lets the compiler work out a local variable's type from the value you assign. It is still strongly typed Java, not JavaScript. Here is how it works, where you can and can't use it, and the traps worth knowing.16 Nov 2026 · 5 min