
☕ Record-based error responses Use records for concise, immutable error response types. Map or Verbose Class → Error Records (JDK 16+) 🔗 javaevolved.dev/errors/recor… #Java #JavaEvolved

Brought to you by @brunoborges and @GitHubCopilot

☕ Record-based error responses Use records for concise, immutable error response types. Map or Verbose Class → Error Records (JDK 16+) 🔗 javaevolved.dev/errors/recor… #Java #JavaEvolved

☕ Switch expressions Switch as an expression that returns a value — no break, no fall-through. Switch Statement → Switch Expression (JDK 14+) 🔗 javaevolved.dev/language/swi… #Java #JavaEvolved

☕ Virtual thread executor Use virtual thread executors for unlimited lightweight concurrency. Fixed Thread Pool → Virtual Thread Executor (JDK 21+) 🔗 javaevolved.dev/streams/virt… #Java #JavaEvolved

☕ JUnit 6 with JSpecify null safety JUnit 6 adopts JSpecify @NullMarked, making null contracts explicit across its assertion API. Unannotated API → @NullMarked API (JDK 17+) 🔗 javaevolved.dev/tooling/juni… #Java #JavaEvolved

☕ File memory mapping Map files larger than 2GB with deterministic cleanup using MemorySegment. MappedByteBuffer → MemorySegment with Arena (JDK 22+) 🔗 javaevolved.dev/io/file-memo… #Java #JavaEvolved

☕ Text blocks for multiline strings Write multiline strings naturally with triple-quote text blocks. String Concatenation → Text Blocks (JDK 15+) 🔗 javaevolved.dev/language/tex… #Java #JavaEvolved

☕ Primitive types in patterns Pattern matching now works with primitive types, not just objects. Manual Range Checks → Primitive Patterns (JDK 25+) 🔗 javaevolved.dev/language/pri… #Java #JavaEvolved

☕ Instant with nanosecond precision Get timestamps with microsecond or nanosecond precision. Milliseconds → Nanoseconds (JDK 9+) 🔗 javaevolved.dev/datetime/ins… #Java #JavaEvolved

☕ Null case in switch Handle null directly as a switch case — no separate guard needed. Guard Before Switch → case null (JDK 21+) 🔗 javaevolved.dev/errors/null-… #Java #JavaEvolved

☕ JNDI Lookup vs CDI Injection Replace fragile JNDI string lookups with type-safe CDI injection for container-managed resources. JNDI Lookup → CDI @Inject (JDK 11+) 🔗 javaevolved.dev/enterprise/j… #Java #JavaEvolved

☕ TLS 1.3 by default TLS 1.3 is enabled by default — no explicit protocol configuration needed. Manual TLS Config → TLS 1.3 Default (JDK 11+) 🔗 javaevolved.dev/security/tls… #Java #JavaEvolved

☕ Manual JPA Transaction vs Declarative @Transactional Replace verbose begin/commit/rollback blocks with a single @Transactiona… Manual Transaction → @Transactional (JDK 11+) 🔗 javaevolved.dev/enterprise/m… #Java #JavaEvolved

☕ Unmodifiable collectors Collect directly to an unmodifiable list with stream.toList(). collectingAndThen → stream.toList() (JDK 16+) 🔗 javaevolved.dev/collections/… #Java #JavaEvolved

☕ Path.of() factory Use Path.of() — the modern factory method on the Path interface. Paths.get() → Path.of() (JDK 11+) 🔗 javaevolved.dev/io/path-of.h… #Java #JavaEvolved

☕ Optional.orElseThrow() without supplier Use Optional.orElseThrow() as a clearer, intent-revealing alternative to get(). get() or orElseThrow(supplier) → orElseThrow() (JDK 10+) 🔗 javaevolved.dev/errors/optio… #Java #JavaEvolved

☕ Duration and Period Calculate time differences with type-safe Duration and Period. Millisecond Math → Duration / Period (JDK 8+) 🔗 javaevolved.dev/datetime/dur… #Java #JavaEvolved