Browse by Topic

Popular

Latest

Latest Java Posts

Java record syntax showing a compact data class declaration with immutable fields and generated accessors.
Java

Java Records: Immutable Data Carriers

Learn how Java records reduce boilerplate for immutable data carriers, including syntax, compact constructors, restrictions, and when to use them instead of traditional classes.

Java RecordsImmutabilityData ClassesJava 16
Illustration of a Java switch expression routing different shape types into distinct result panels, representing type pattern matching.
Java

Java Switch Expression Pattern Matching

Learn how Java switch expression pattern matching works: type patterns, guarded cases, sealed-type exhaustiveness, null handling, and common pitfalls.

Javaswitch expressionspattern matchingtype patterns
Diagram showing a Java switch expression branching over enum constants
Java

Java Switch Expression with Enum Types

Learn how to use Java switch expressions with enums: arrow syntax, yield, exhaustiveness, grouped cases, and compatibility notes.

Javaswitch expressionenumyield
Diagram showing multiple case labels mapping to a single switch expression branch in Java.
Java

Java switch expression multiple cases

java switch expression multiple cases: Learn how to use Java switch expressions with multiple case labels, including arrow syntax, yield, and common pitfalls.

Javaswitch expressionmultiple case labelsarrow syntax
Illustration of a Java switch expression with multiple branches converging into a single output value through the yield keyword
Java

Java Switch Expressions: How the yield Keyword Produces Values

Learn how the Java yield keyword produces values from switch expressions, when to use it, and how it differs from the return statement.

switch expressionsyield keywordJava 14arrow syntax
Illustration of Java switch expression with arrow syntax and yield keyword
Java

Java Switch Expressions: Syntax and Usage

Learn how Java switch expressions work, including arrow syntax, yield, exhaustiveness, and practical differences from switch statements.

JavaSwitch ExpressionsArrow SyntaxYield
Java text block indentation diagram showing how the compiler strips common leading whitespace from multi-line strings
Java

Java Text Block Indentation: How to Control It

Java text block indentation is stripped based on the block's minimum indentation. Learn how the compiler removes incidental whitespace, how the backslash escape joins lines, and when to use stripIndent() and indent().

text blocksindentationmulti-line stringsstripIndent
Editorial illustration of Java text block syntax showing triple quotes and indented multiline string lines on a code panel.
Java

Java Text Block Syntax: Multiline Strings in Practice

java text block syntax: Learn Java text block syntax for multiline strings: delimiters, indentation stripping and escape sequences, plus formatting and migration guida...

text blocksmultiline stringsstring formattingstring literals
Diagram showing a Java record containing a nested record being deconstructed into its fields by a pattern matching arrow
Java

Java Nested Record Patterns Explained

Learn how Java nested record patterns can deconstruct complex records safely and concisely in a single pattern, with syntax examples, switch usage, and limitations.

JavaRecord PatternsPattern MatchingDeconstruction
Illustration of a Java record being split into its component variables by a pattern matching operation.
Java

Java Record Pattern Matching in Practice

java record pattern matching: Learn how Java record patterns deconstruct records in instanceof and switch, with nested patterns, guards, and null handling.

java recordspattern matchingswitch expressionsinstanceof