Tagged articles

Optional

109 articles · Page 2 of 2
Java Captain
Java Captain
Dec 25, 2019 · Backend Development

Handling Null Values and Optional in Java: Best Practices and Design Patterns

This article discusses common null‑value pitfalls in Java services, explains why returning null collections is dangerous, and presents robust solutions such as returning empty lists, using Optional, applying JSR‑303/JSR‑305 annotations, and employing the Null Object pattern to improve code safety and readability.

Design PatternsJSR-303JSR-305
0 likes · 13 min read
Handling Null Values and Optional in Java: Best Practices and Design Patterns
Java Backend Technology
Java Backend Technology
Dec 18, 2019 · Backend Development

Mastering Null Handling in Java: Optional, Null Object Pattern & JSR 303/305

This article examines common pitfalls of null values in Java backend code, explains why returning null collections or objects can cause NullPointerExceptions, and presents robust solutions such as returning empty collections, using Optional, applying JSR‑303 validation, JSR‑305 annotations, and the Null Object pattern to improve API safety and readability.

API DesignJSR-303JSR-305
0 likes · 13 min read
Mastering Null Handling in Java: Optional, Null Object Pattern & JSR 303/305
Programmer DD
Programmer DD
Dec 7, 2019 · Fundamentals

Eliminate NullPointerExceptions with the Null Object Pattern and Optional

This article explains why excessive null‑checks cause a "null‑check disaster", introduces the Null Object design pattern and Java 8 Optional as clean alternatives, and showcases the NR Null Object IntelliJ plugin that can generate null‑object scaffolding automatically.

IntelliJ PluginJavaKotlin
0 likes · 10 min read
Eliminate NullPointerExceptions with the Null Object Pattern and Optional
Programmer DD
Programmer DD
Jul 15, 2019 · Backend Development

Master Java Optional to Eradicate NullPointerExceptions and Write Cleaner Code

This article explains why NullPointerExceptions occur in Java, introduces the Optional class from Java 8 as a type‑safe alternative to null, and provides practical tips, code examples, and real‑world cases for using Optional to simplify error handling and improve API design.

API DesignJavaNullPointerException
0 likes · 7 min read
Master Java Optional to Eradicate NullPointerExceptions and Write Cleaner Code
Java Captain
Java Captain
Apr 20, 2019 · Fundamentals

Understanding Java Lambda Expressions, Functional Interfaces, Streams, and Optional

This article explains how Java 8 lambda expressions let you assign blocks of code to variables, how they are tied to functional interfaces, and demonstrates step‑by‑step simplifications using built‑in functional interfaces, forEach, stream(), method references, and Optional for elegant null handling.

Functional InterfaceJavaJava 8
0 likes · 6 min read
Understanding Java Lambda Expressions, Functional Interfaces, Streams, and Optional
Java Captain
Java Captain
Jan 5, 2019 · Fundamentals

Avoiding NullPointerException with the Null Object Pattern and Optional in Java

This article explains the "null‑check disaster" in Java, introduces the Null Object design pattern with full code examples, presents the NR Null Object IntelliJ plugin for automatic generation, and demonstrates how Java 8 Optional and Kotlin safe‑call operators can provide cleaner, null‑safe alternatives.

DesignPatternJavaNullObject
0 likes · 9 min read
Avoiding NullPointerException with the Null Object Pattern and Optional in Java
Liulishuo Tech Team
Liulishuo Tech Team
Apr 11, 2018 · Mobile Development

Understanding map, flatMap, and compactMap in Swift

This article explains the differences between map, flatMap, and compactMap in Swift, covering the three overloads of flatMap, their behavior with sequences and optionals, the rationale behind renaming one overload to compactMap, and when to prefer optional chaining versus optional mapping.

OptionalSwiftcompactMap
0 likes · 8 min read
Understanding map, flatMap, and compactMap in Swift
Qunar Tech Salon
Qunar Tech Salon
Nov 21, 2014 · Backend Development

Using Guava to Avoid Null, Enforce Preconditions, and Simplify Optional, Ordering, and Throwables in Java

The article explains how Guava helps Java developers avoid null-related bugs, enforce method preconditions, replace cumbersome Object methods with utilities like Optional, Objects, and Ordering, and provides concise patterns for exception propagation using Throwables, all illustrated with clear code examples.

GuavaJavaOptional
0 likes · 18 min read
Using Guava to Avoid Null, Enforce Preconditions, and Simplify Optional, Ordering, and Throwables in Java