Tagged
#Java
10 posts
-
Java LTS Evolution: From Java 8 to Java 25 — A Language Upgrade Guide
From Java 8's lambdas and streams to Java 25's virtual threads, stream gatherers, and compact object headers — a tour of the five LTS releases (8, 11, 17, 21, 25), each OpenJDK distribution's free-support deadline, and a quick look at what the just-GA non-LTS Java 26 brings. A reference map for anyone still on Java 8 / 11 thinking about upgrading.
-
Evolution of Java's switch: From Java 7 to Java 26
A tour of how Java's switch keyword has evolved — String cases in Java 7, switch expressions and the yield keyword in Java 14, pattern matching shipped as a standard feature in Java 21 with null cases, when guards, and exhaustiveness for sealed types, and the still-previewing Primitive Types in Patterns up through Java 26.
-
Which OpenJDK Distribution Should You Use? Temurin, Corretto, Zulu, and More
Downloading Java in 2026 is not as simple as it used to be. OracleJDK, OpenJDK, Eclipse Temurin, Amazon Corretto, Azul Zulu, Microsoft Build of OpenJDK, IBM Semeru, Oracle GraalVM, BellSoft Liberica — same "JDK" label, different licenses, maintainers, and platform support. This article walks through Oracle's licensing history from Java 8 through Java 25 (including the 2023 per-employee pricing change) and then compares the nine mainstream distributions so you can pick one that fits your situation.
-
Arrays.asList() vs List.of() in Java: Why They Behave Differently
Java gives you two convenient ways to build a list in one line — Arrays.asList() (since Java 1.2) and List.of() (since Java 9). They look interchangeable, but they return different classes with very different mutability rules: one lets you overwrite elements, the other throws UnsupportedOperationException on any modification. This post walks through the differences, the internals that cause them, and when to reach for each.
-
Content-Disposition with Unicode Filenames in Java: Fixing the IllegalArgumentException
If your download endpoint returns an IllegalArgumentException complaining about a code point outside the range 0–255, the culprit is ISO-8859-1. HTTP headers don't accept raw UTF-8, so Content-Disposition needs percent-encoded filenames and the filename* parameter. This post shows the minimal Java / Spring fix.
-
Java 8 Date and Time API Tutorial: LocalDateTime, Instant, Duration with Examples
Before Java 8, developers juggled Unix timestamps as longs or wrestled with java.util.Date. Java 8 introduced java.time — a cleaner, immutable, time-zone-aware API covering dates, times, timestamps, and durations. This tutorial walks through the core classes and shows practical examples for the operations you will actually use.
-
Get File Extension and MIME Type in Java Without Third-Party Libraries
You don't need Apache Commons or Guava to pull the extension off a filename or detect its MIME type. Java 7's NIO and Java 8's Optional / Stream API are enough — and the code you end up with is short, null-safe, and easy to paste into any project. This article walks through both recipes, then covers the Paths.get vs Path.of split and the cross-platform quirks of Files.probeContentType.
-
How to Fix "failed to lazily initialize a collection" in Spring Data JPA and Hibernate
Hibernate's LazyInitializationException ("failed to lazily initialize a collection") is a classic pitfall when reading foreign-key collections outside an active session. This article explains why it happens — fetch types, the session lifecycle, proxy traps — and walks through the recommended `@Transactional` fix plus the `FetchType.EAGER` alternative.
-
Java 17 Sealed Classes: sealed, non-sealed, final, and permits Explained
Java 17 promoted sealed classes and interfaces to a standard feature after debuting as a preview in Java 15. This post walks through how sealed, non-sealed, permits, and final fit together to give you precise control over who can extend a class or implement an interface — plus a step-by-step animal hierarchy example (Animal → Chordata → Bird → Parrot / Penguin) that demonstrates every state in action.
-
Java 16 record Tutorial: How record, Lombok, and POJO Compare
Java 16 added a new kind of class called record, designed specifically for holding data. This post walks through record, compares it side-by-side with traditional POJOs and Lombok's code-generation annotations, and shows where each approach still has a place — including why record can't fully replace Lombok's Builder or mutable POJOs.