Java guides
Every published Java guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Java guides
Most readLatest Java guides
Page 8 of 109Java Type Patterns: instanceof and switch
Learn how Java type patterns simplify instanceof checks and switch statements, with practical examples of pattern variables, flow scoping, guarded patterns, and record patterns.
Java Pattern Matching Switch
java pattern matching switch: Learn how to use pattern matching for switch in Java: syntax, guarded patterns, exhaustiveness, null handling, and practical migration tips.
Java Pattern Variables: Cleaner Type Checks Without Casts
Learn how Java pattern variables simplify instanceof checks and switch patterns, including their scope rules and Java version requirements.
Java var vs Object: Type Inference vs Explicit Reference
java var vs object: Understand the difference between Java's var and Object declarations, how type inference works, and when to use each for maintainable code.
Using var with Lambda Expressions in Java
How var interacts with lambda expressions in Java: why var cannot hold a lambda, how var works in lambda parameters since Java 11, and the all-or-nothing rule.
Java var with Generics: Type Inference Explained
Understand how Java's var keyword infers generic types, including the diamond operator, generic method calls, anonymous classes, and common pitfalls.
Java Local Variable Type Inference: Using var Effectively
java local variable type inference: Learn how Java's var keyword works, where it can be used, and how it affects readability, maintainability, and runtime behavior in...
Java Immutable vs Unmodifiable Collection: Key Differences
Understand the difference between immutable and unmodifiable collections in Java, including behavior, performance, and when to use each.
Java Immutable Collections: List.of, Set.of, Map.of, and Unmodifiable Views
Learn to create Java immutable collections with List.of, Set.of, and Map.of, and see how they differ from unmodifiable view wrappers.
Java Null Safe Equals with Objects.equals
Learn how to perform null-safe equality checks in Java using Objects.equals, and understand the tradeoffs of manual null handling.