Tagged articles

Optional

106 articles · Page 2 of 2
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 DesignCode RefactoringNullPointerException
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 InterfaceJava 8Lambda
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.

DesignPatternNullObjectNullPointerException
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.

Functional ProgrammingOptionalSwift
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.

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