Tagged articles
85 articles
Page 1 of 1
Coder Trainee
Coder Trainee
Mar 1, 2026 · Backend Development

Using Java Optional to Eliminate NullPointerException

The article explains how Java 8's Optional class can prevent NullPointerException by introducing common methods such as empty, of, isPresent, orElse, orElseGet, and orElseThrow, and demonstrates their usage with a complete code example and its output.

functional programmingjava8nullpointerexception
0 likes · 4 min read
Using Java Optional to Eliminate NullPointerException
Top Architect
Top Architect
Dec 20, 2025 · Backend Development

Master Null Checks in Java: When to Use StringUtils, ObjectUtils, and CollectionUtils

This article explains how to replace repetitive null‑checks in Java with the appropriate utility classes—StringUtils for strings, ObjectUtils for objects, arrays, lists and maps, and CollectionUtils for collections—providing step‑by‑step guidance, code examples, and a discussion of each method's limitations.

BestPracticesCollectionUtilsJava
0 likes · 8 min read
Master Null Checks in Java: When to Use StringUtils, ObjectUtils, and CollectionUtils
Java Tech Enthusiast
Java Tech Enthusiast
Nov 2, 2025 · Backend Development

Master Elegant Null Checks in Java with StringUtils and ObjectUtils

This article explains how to replace repetitive !=null checks in Java with concise, type‑aware utility methods such as StringUtils, ObjectUtils, Collections, and CollectionUtils, providing code examples and discussing the underlying implementations and their limitations for different data types.

BestPracticesJavaObjectUtils
0 likes · 8 min read
Master Elegant Null Checks in Java with StringUtils and ObjectUtils
Java Backend Technology
Java Backend Technology
Jul 18, 2025 · Backend Development

Why Did My New Java Developer Trigger NPE? Lessons & Fixes

A new Java developer caused a production NullPointerException while matching third‑party data, and the article walks through reproducing the bug, analyzing each faulty line, and applying defensive programming techniques such as early returns, Optional, Objects.equals, and collection checks to prevent similar crashes.

Objects.equalscode qualitydefensive programming
0 likes · 6 min read
Why Did My New Java Developer Trigger NPE? Lessons & Fixes
Java Tech Enthusiast
Java Tech Enthusiast
Jul 1, 2025 · Cloud Computing

Why Did the 2025 Multi-Cloud Outage Cripple Google, AWS, and Azure?

In June 2025 a 181‑minute global outage knocked down Google Cloud, AWS, and Azure, exposing the fragility of multi‑cloud strategies as a single null‑pointer bug cascaded through cross‑dependent services, leading to massive alerts, latency spikes, and widespread service failures.

AWSAzureDigital Infrastructure
0 likes · 4 min read
Why Did the 2025 Multi-Cloud Outage Cripple Google, AWS, and Azure?
Cognitive Technology Team
Cognitive Technology Team
Jun 17, 2025 · Cloud Computing

What a Single NullPointerException Taught Us About Cloud Reliability

The June 2025 Google Cloud outage, caused by an untested code change that triggered a NullPointerException, crippled over 70 core services worldwide, prompting a rapid technical fix, public apology, and industry‑wide reflections on cloud stability, fault tolerance, and deployment practices.

Google Cloudcloud outageincident response
0 likes · 7 min read
What a Single NullPointerException Taught Us About Cloud Reliability
IT Services Circle
IT Services Circle
Mar 18, 2025 · Backend Development

Why Debugging a Simple ConcurrentLinkedQueue Triggers a NullPointerException in IntelliJ IDEA

The article recounts a puzzling case where a minimal Java program using ConcurrentLinkedQueue runs fine normally but throws a NullPointerException when debugged in IntelliJ IDEA, explains the underlying cause involving the IDE's automatic toString invocation, and shows how to disable the offending settings.

ConcurrentLinkedQueueIntelliJ IDEAJava
0 likes · 9 min read
Why Debugging a Simple ConcurrentLinkedQueue Triggers a NullPointerException in IntelliJ IDEA
Architect's Guide
Architect's Guide
Feb 24, 2025 · Backend Development

Using Java Optional to Prevent NullPointerException

This article introduces Java 8's Optional class, explains its creation methods and common operations such as get, isPresent, ifPresent, filter, map, flatMap, orElse, orElseGet, orElseThrow, and shows practical usage scenarios and best‑practice recommendations for handling null values in backend code.

BackendJavafunctional programming
0 likes · 15 min read
Using Java Optional to Prevent NullPointerException
Java Architect Essentials
Java Architect Essentials
Jan 3, 2025 · Backend Development

Using Java 8 Optional to Prevent NullPointerException: Methods, Examples, and Best Practices

This article introduces Java 8's Optional class as a robust solution for avoiding NullPointerException, explains its creation methods, demonstrates common operations such as get, isPresent, ifPresent, filter, map, flatMap, orElse, orElseGet, orElseThrow, and provides practical usage scenarios and cautions for developers.

BestPracticesJavajava8
0 likes · 16 min read
Using Java 8 Optional to Prevent NullPointerException: Methods, Examples, and Best Practices
macrozheng
macrozheng
Dec 19, 2024 · Backend Development

Master Java Optional: Clean Null Handling with Real-World Examples

This article introduces Java's Optional class, explains why null checks cause clutter, demonstrates how to replace traditional three‑level null‑checking with concise Optional chains, and provides detailed examples of all core Optional methods such as empty, of, ofNullable, isPresent, get, ifPresent, filter, map, flatMap, orElse, orElseGet, and orElseThrow.

BackendJavajava8
0 likes · 11 min read
Master Java Optional: Clean Null Handling with Real-World Examples
DaTaobao Tech
DaTaobao Tech
Aug 23, 2024 · Fundamentals

Common Java Pitfalls and Their Solutions

The article outlines frequent Java pitfalls—including BigDecimal precision loss, immutable lists from Arrays.asList, double division by zero returning Infinity, null values in switch statements, stream filters mutating original objects, and autoboxing nulls causing NullPointerExceptions—and provides clear explanations and practical fixes to enhance code reliability.

Arrays.asListAutoboxingBigDecimal
0 likes · 5 min read
Common Java Pitfalls and Their Solutions
macrozheng
macrozheng
Jul 23, 2024 · Fundamentals

Mastering Java Optional: Eliminate NullPointerExceptions with Clean Code

This article explains why NullPointerExceptions occur, introduces Java's Optional as a concise alternative to explicit null checks, demonstrates practical code transformations, and reviews all core Optional methods introduced in JDK 8 to improve readability and safety of Java applications.

CodeCleanlinessJavajava8
0 likes · 10 min read
Mastering Java Optional: Eliminate NullPointerExceptions with Clean Code
Code Ape Tech Column
Code Ape Tech Column
Jul 2, 2024 · Backend Development

How to Use Java Stream toMap with Duplicate Keys and Null Values

This article demonstrates how to convert a list of Java objects into a Map using Stream's toMap collector, addresses duplicate key exceptions by providing a merge function, handles null values with Optional, and compares stream-based solutions with traditional for-loop approaches.

DuplicateKeyJavaStream
0 likes · 6 min read
How to Use Java Stream toMap with Duplicate Keys and Null Values
Architecture Digest
Architecture Digest
Jun 23, 2024 · Backend Development

Debugging and Preventing NullPointerException in Java Backend Data Processing

This article presents a real-world Java backend case where null pointer exceptions arise during data matching and batch insertion, analyzes the root causes in each code line, and offers defensive programming, ternary, Optional, collection checks, and utility methods to safely handle null values.

collection-utilsdefensive programmingnullpointerexception
0 likes · 5 min read
Debugging and Preventing NullPointerException in Java Backend Data Processing
Su San Talks Tech
Su San Talks Tech
May 20, 2024 · Backend Development

Mastering Java Optional: When to Use It and Common Pitfalls

This article explores the proper usage of Java's Optional class, debunks common misconceptions, examines its internal implementation, compares methods like map, orElse, orElseGet, and provides practical code examples to help developers avoid null‑pointer pitfalls and write cleaner backend code.

Backend DevelopmentCode ExampleJava
0 likes · 11 min read
Mastering Java Optional: When to Use It and Common Pitfalls
Java Interview Crash Guide
Java Interview Crash Guide
May 9, 2024 · Backend Development

Why Does FastJSON Invoke isChinaName()? Uncovering Hidden Serialization Pitfalls

A seemingly harmless log addition triggered a cascade of FastJSON serialization calls, leading to a NullPointerException caused by the isChinaName() method, and the article walks through the debugging process, explains the underlying serialization mechanics, and proposes a clean solution using @JSONField(serialize=false).

DebuggingJSONFieldJava serialization
0 likes · 8 min read
Why Does FastJSON Invoke isChinaName()? Uncovering Hidden Serialization Pitfalls
Alibaba Cloud Developer
Alibaba Cloud Developer
Apr 15, 2024 · Backend Development

Mastering Java Pitfalls: NPE, Thread Safety, and Performance Best Practices

This article compiles common Java bugs such as NullPointerException, thread‑safety issues, improper exception handling, and performance traps, and provides practical solutions including annotations, Optional, MapStruct, concurrent utilities, immutable objects, proper resource management, and Spring transaction safeguards.

Exception Handlingbest practicesconcurrency
0 likes · 23 min read
Mastering Java Pitfalls: NPE, Thread Safety, and Performance Best Practices
dbaplus Community
dbaplus Community
Mar 21, 2024 · Fundamentals

Why NullPointerExceptions Haunt Java Developers and How to Defeat Them

The article explores the notorious Java NullPointerException, its historical roots in Tony Hoare's introduction of null, modern JDK 14 diagnostic improvements, and practical defensive programming techniques—including explicit null checks, avoiding null returns, and leveraging Optional—to write safer, more robust code.

defensive programmingjava8nullpointerexception
0 likes · 6 min read
Why NullPointerExceptions Haunt Java Developers and How to Defeat Them
Architect
Architect
Oct 11, 2023 · Backend Development

Understanding and Using Java Optional to Avoid NullPointerException

This article explains the purpose and usage of Java 8's Optional class, demonstrates how to create and manipulate Optional objects, compares its various methods such as get, isPresent, ifPresent, filter, map, flatMap, orElse, orElseGet, orElseThrow, and highlights JDK 9 enhancements and practical best‑practice scenarios.

Javabest practicesjava8
0 likes · 15 min read
Understanding and Using Java Optional to Avoid NullPointerException
Architecture Digest
Architecture Digest
Sep 18, 2023 · Backend Development

Using Java 8 Optional to Avoid NullPointerException: API Overview and Practical Examples

This article explains the NullPointerException problem in Java, introduces the Java 8 Optional class, details its constructors and key methods such as of, ofNullable, empty, orElse, orElseGet, orElseThrow, map, flatMap, isPresent, ifPresent, and filter, and provides practical code examples demonstrating more elegant null‑handling.

APIFunctionalProgrammingJava
0 likes · 10 min read
Using Java 8 Optional to Avoid NullPointerException: API Overview and Practical Examples
Architect's Guide
Architect's Guide
Sep 12, 2023 · Backend Development

Using Java 8 Optional API to Eliminate NullPointerException

This article explains how Java 8's Optional class and its methods—of, ofNullable, empty, orElse, orElseGet, orElseThrow, map, flatMap, isPresent, ifPresent, and filter—can replace verbose null‑checks, making code more concise and safer while providing concrete examples and source code.

APIBackendJava
0 likes · 10 min read
Using Java 8 Optional API to Eliminate NullPointerException
转转QA
转转QA
Aug 31, 2023 · Backend Development

Resolving a NullPointerException Caused by In‑Place Modification of Apollo Configuration

The article recounts a production incident where a new backend feature introduced a NullPointerException due to directly mutating an Apollo configuration object, describes the debugging steps taken—including log analysis, environment replication, service restart, and code review—and explains the final fix of returning a copy of the configuration to prevent shared‑state corruption.

ApolloJavanullpointerexception
0 likes · 8 min read
Resolving a NullPointerException Caused by In‑Place Modification of Apollo Configuration
Architecture Digest
Architecture Digest
Jul 25, 2023 · Backend Development

Understanding Java 8 Optional: API Overview, Core Methods, and Practical Usage

This article explains the NullPointerException problem, shows traditional null‑checking code, introduces Java 8's Optional class with its constructors and key methods such as of, ofNullable, orElse, orElseGet, orElseThrow, map, flatMap, isPresent, ifPresent, and filter, and provides several real‑world examples illustrating how to replace verbose null checks with elegant Optional‑based code.

BackendFunctionalProgrammingJava
0 likes · 10 min read
Understanding Java 8 Optional: API Overview, Core Methods, and Practical Usage
Top Architect
Top Architect
Mar 9, 2023 · Backend Development

Handling NullPointerExceptions in Java: Practices, Tools, and Code Examples

This article explains common null pointer scenarios in Java, how to diagnose them using logs and Arthas, and presents defensive checks, early‑return patterns, strict validation, and Java 8 Optional usage, while also comparing Stream map and flatMap methods with practical code examples.

ArthasJavaStream
0 likes · 7 min read
Handling NullPointerExceptions in Java: Practices, Tools, and Code Examples
Java Architect Essentials
Java Architect Essentials
Feb 15, 2023 · Backend Development

Mastering Java Optional: Creation, Methods, Real‑World Use Cases and Pitfalls

This article explains Java's Optional class, showing how to create empty or non‑empty instances, detailing key methods such as get, isPresent, ifPresent, orElse, orElseGet, orElseThrow, map, flatMap, filter, and illustrating practical service‑layer scenarios, JDK 9 enhancements, and when overusing Optional can hurt readability.

CodeExampleFunctionalProgrammingJDK9
0 likes · 10 min read
Mastering Java Optional: Creation, Methods, Real‑World Use Cases and Pitfalls
Java Architect Essentials
Java Architect Essentials
Nov 2, 2022 · Backend Development

Using Java 8 Optional to Simplify Null‑Pointer Handling

This article introduces Java 8's Optional class, explains how to create Optional objects, demonstrates the most common methods such as get, isPresent, ifPresent, filter, map, flatMap, orElse, orElseGet, orElseThrow, compares similar APIs, provides real‑world service‑layer examples, and highlights JDK 9 enhancements, helping developers write safer, more readable code while avoiding NullPointerException.

FunctionalProgrammingjava8nullpointerexception
0 likes · 12 min read
Using Java 8 Optional to Simplify Null‑Pointer Handling
Top Architect
Top Architect
Oct 20, 2022 · Backend Development

Mastering Java Optional: Preventing NullPointerException with Java 8

This article explains how Java 8's Optional class can be used to avoid NullPointerException by providing a comprehensive guide that covers creation, common methods, practical use‑cases, and recent JDK 9 enhancements, complete with code examples and best‑practice recommendations.

BestPracticesFunctionalProgrammingJava
0 likes · 14 min read
Mastering Java Optional: Preventing NullPointerException with Java 8
Selected Java Interview Questions
Selected Java Interview Questions
Oct 8, 2022 · Backend Development

Improved NullPointerException Handling in Java 14 (JEP 358)

The article explains how Java 14 introduces enhanced NullPointerException messages via JEP 358, showing traditional NPE problems, the new detailed exception output, required JVM flags, performance considerations, and potential security implications, with code examples illustrating the improvements.

Exception HandlingJEP 358java14
0 likes · 7 min read
Improved NullPointerException Handling in Java 14 (JEP 358)
Java Captain
Java Captain
Sep 27, 2022 · Backend Development

Understanding and Preventing NullPointerException in Java Backend Development

This article presents a real-world Java backend case where a newly hired developer caused a NullPointerException during data matching and batch insertion, analyzes each line of the problematic code, and offers defensive programming techniques such as null checks, Optional, and utility methods to avoid NPEs.

Backend DevelopmentJavadefensive programming
0 likes · 5 min read
Understanding and Preventing NullPointerException in Java Backend Development
Top Architect
Top Architect
Sep 16, 2022 · Backend Development

Mastering Java 8 Optional to Eliminate NullPointerException

This article explains how Java 8's Optional class can be used to simplify null‑checking, avoid NullPointerException, and write more readable backend code by demonstrating its creation methods, common operations like get, isPresent, ifPresent, filter, map, flatMap, orElse, orElseGet, orElseThrow, and new JDK 9 enhancements with practical code examples.

Javajava8nullpointerexception
0 likes · 14 min read
Mastering Java 8 Optional to Eliminate NullPointerException
Code Ape Tech Column
Code Ape Tech Column
Jul 9, 2022 · Backend Development

Using Java 8 Optional to Avoid NullPointerException

This article explains how Java 8's Optional class can replace verbose null‑checking code, introduces its core API methods such as of, ofNullable, empty, orElse, orElseGet, orElseThrow, map, flatMap, isPresent, ifPresent, and filter, and provides practical code examples for safer null handling.

functional programmingnullpointerexceptionoptional
0 likes · 9 min read
Using Java 8 Optional to Avoid NullPointerException
Java Backend Technology
Java Backend Technology
Jun 25, 2022 · Fundamentals

Why Java Wrapper Classes Can Kill Performance and Trigger NPEs

This article explains how Java wrapper classes, introduced with generics, provide boxing and unboxing sugar but can cause subtle bugs such as incorrect == comparisons, severe performance penalties, unexpected NullPointerExceptions, and confusing API usage, and it offers practical best‑practice guidelines.

BoxingJavaUnboxing
0 likes · 9 min read
Why Java Wrapper Classes Can Kill Performance and Trigger NPEs
Java Architect Essentials
Java Architect Essentials
Apr 30, 2022 · Fundamentals

Understanding Java Optional: API Overview and Practical Usage

This article explains the NullPointerException problem, introduces the Java 8 Optional API—including constructors, of, ofNullable, empty, orElse, orElseGet, orElseThrow, map, flatMap, isPresent, ifPresent, and filter—provides source code snippets, and demonstrates how to replace verbose null‑checks with elegant Optional‑based implementations.

APIFunctionalProgrammingjava8
0 likes · 9 min read
Understanding Java Optional: API Overview and Practical Usage
Java Architect Essentials
Java Architect Essentials
Apr 22, 2022 · Backend Development

Master Java Optional: Clean Null Handling with Real Code Examples

This article explains the NullPointerException problem in Java, introduces the Optional API introduced in Java 8, details each method such as of, ofNullable, empty, orElse, orElseGet, orElseThrow, map, flatMap, filter, isPresent and ifPresent, and provides practical code examples that replace verbose null‑checks with concise, functional style.

Javafunctional programmingjava8
0 likes · 10 min read
Master Java Optional: Clean Null Handling with Real Code Examples
Java Architect Essentials
Java Architect Essentials
Feb 17, 2022 · Backend Development

Using Java 8 Optional to Eliminate NullPointerException: API Overview and Practical Examples

This article explains the frequent NullPointerException issue in Java, introduces the Optional class and its constructors and methods such as of, ofNullable, orElse, orElseGet, orElseThrow, map, flatMap, isPresent, ifPresent, and filter, and demonstrates how to replace verbose null‑checks with concise Optional‑based code through several real‑world examples.

functional programmingjava8nullpointerexception
0 likes · 10 min read
Using Java 8 Optional to Eliminate NullPointerException: API Overview and Practical Examples
Code Ape Tech Column
Code Ape Tech Column
Nov 3, 2021 · Backend Development

Best and Bad Practices for Using Java Optional

This article explains the purpose of Java 8's Optional class, illustrates common misunderstandings, lists several bad usage patterns, and provides a set of recommended best‑practice APIs and tips to help developers handle nullable values safely and elegantly in backend Java code.

BackendJavabest practices
0 likes · 13 min read
Best and Bad Practices for Using Java Optional
Selected Java Interview Questions
Selected Java Interview Questions
May 25, 2021 · Fundamentals

Understanding and Leveraging Java Optional: Creation, Access, Default Values, Exceptions, Transformations, Filtering, and Java 9 Enhancements

This article provides a comprehensive guide to Java's Optional class, covering its purpose for avoiding NullPointerExceptions, how to create and access Optional instances, default‑value methods, exception handling, value transformation, filtering, method chaining, and new features introduced in Java 9.

JavaJava9Stream
0 likes · 13 min read
Understanding and Leveraging Java Optional: Creation, Access, Default Values, Exceptions, Transformations, Filtering, and Java 9 Enhancements
Architect's Alchemy Furnace
Architect's Alchemy Furnace
May 7, 2021 · Backend Development

Eliminate NullPointerExceptions in Java with Optional: A Practical Guide

This article explains why traditional nested null‑checks cause NullPointerExceptions in Java, introduces the Optional class introduced in Java 8, and demonstrates how its constructors and fluent APIs like ofNullable, orElse, map, flatMap, and filter can replace verbose checks with concise, safe code.

Code RefactoringJavanullpointerexception
0 likes · 10 min read
Eliminate NullPointerExceptions in Java with Optional: A Practical Guide
Java Backend Technology
Java Backend Technology
May 6, 2021 · Backend Development

Master Java 8 Optional to Eliminate NullPointerExceptions

This article explains why NullPointerExceptions occur in Java, introduces the Optional API introduced in Java 8, details its core methods with source code examples, and demonstrates practical usage patterns that replace verbose null‑checks with concise, expressive functional code.

APIFunctionalProgrammingJava
0 likes · 9 min read
Master Java 8 Optional to Eliminate NullPointerExceptions
Java High-Performance Architecture
Java High-Performance Architecture
Nov 6, 2020 · Fundamentals

Java 14 Made Easy: Records, Pattern Matching, Switch Expressions & Clear NPEs

This article explains how Java 14 introduces Records to reduce boilerplate class definitions, Pattern Matching to streamline instanceof checks, Switch expressions to treat switch as a value-producing construct, and enhanced NullPointerException messages that pinpoint the exact null source, making code clearer and more concise.

Java 14Switch Expressionsnullpointerexception
0 likes · 5 min read
Java 14 Made Easy: Records, Pattern Matching, Switch Expressions & Clear NPEs
Top Architect
Top Architect
Jul 30, 2020 · Backend Development

Using Java 8 Optional to Eliminate Null Checks and Simplify Code

This article explains the Java 8 Optional class, demonstrates how it replaces traditional null‑checking with functional methods such as of, ofNullable, map, orElse, filter, and provides best‑practice guidelines for creating and using Optional objects to write cleaner backend code.

BackendJavafunctional programming
0 likes · 9 min read
Using Java 8 Optional to Eliminate Null Checks and Simplify Code
JavaEdge
JavaEdge
Jun 25, 2020 · Backend Development

Why Using Java Optional Can Eliminate NullPointerExceptions and Simplify Code

This article explains how Java's Optional class provides a lightweight proxy for null values, preventing NullPointerExceptions, and demonstrates best‑practice patterns for immutable objects, field validation, and clean API design with concrete code examples.

Immutablebest-practicesdesign-patterns
0 likes · 6 min read
Why Using Java Optional Can Eliminate NullPointerExceptions and Simplify Code
Programmer DD
Programmer DD
Apr 20, 2020 · Backend Development

How Java 14’s Enhanced NullPointerException Simplifies Debugging

Java 14’s enhanced NullPointerException, introduced via JEP 358, provides detailed messages that pinpoint the exact null variable in a stack trace, dramatically simplifying debugging of chained calls and reducing time spent hunting down elusive bugs.

JEP 358Javajava14
0 likes · 6 min read
How Java 14’s Enhanced NullPointerException Simplifies Debugging
FunTester
FunTester
Apr 12, 2020 · Fundamentals

Why Groovy’s null behaves differently from Java’s null – A deep dive

This article compares Java’s null, which throws NullPointerException on member access, with Groovy’s NullObject that safely handles method calls, explains the underlying implementation, demonstrates practical code examples, and shows how to customize NullObject behavior via metaClass extensions.

GroovyJavaNullObject
0 likes · 4 min read
Why Groovy’s null behaves differently from Java’s null – A deep dive
High Availability Architecture
High Availability Architecture
Mar 19, 2020 · Backend Development

New Features in Java 14: Switch Expressions, Pattern Matching for instanceof, Helpful NullPointerExceptions, Records and More

The article introduces the major Java 14 enhancements—including standard switch expressions, preview pattern matching for instanceof, more informative NullPointerExceptions, preview records, text blocks, and several JVM and library improvements—while providing code examples that illustrate how each feature simplifies Java development.

JEPJava 14nullpointerexception
0 likes · 6 min read
New Features in Java 14: Switch Expressions, Pattern Matching for instanceof, Helpful NullPointerExceptions, Records and More
Programmer DD
Programmer DD
Oct 23, 2019 · Backend Development

Java 13 & 14 Highlights: Text Blocks, Better NPEs, and Switch Expressions

Java 13 introduced five new features, with Text Blocks gaining the most attention, while the upcoming Java 14 Early‑Access preview highlights three potential enhancements: improved NullPointerExceptions, a new non‑volatile memory mapped byte buffer mode, and the stabilization of Switch Expressions with pattern‑matching syntax.

JDKJavaSwitch Expressions
0 likes · 5 min read
Java 13 & 14 Highlights: Text Blocks, Better NPEs, and Switch Expressions
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.

Backend DevelopmentCode RefactoringJava
0 likes · 7 min read
Master Java Optional to Eradicate NullPointerExceptions and Write Cleaner Code
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
ITFLY8 Architecture Home
ITFLY8 Architecture Home
May 27, 2018 · Backend Development

10 Paranoid Java Tricks Every Developer Should Know

This article shares a seasoned developer’s top ten obsessive Java programming techniques—ranging from placing string literals first to avoid NullPointerExceptions, never trusting early JDK APIs, treating -1 cautiously, enforcing final modifiers, and rigorously structuring switch statements—to help you write safer, more maintainable code.

best practicesfinalnullpointerexception
0 likes · 9 min read
10 Paranoid Java Tricks Every Developer Should Know
Qunar Tech Salon
Qunar Tech Salon
Mar 21, 2015 · Fundamentals

Understanding Null in Java: Causes, Behaviors, and Best Practices

This article explains the role of the null keyword in Java, its default value for reference types, common pitfalls such as NullPointerException caused by autoboxing, improper primitive assignments, instanceof checks, static method calls on null references, and safe handling techniques to write null‑safe code.

AutoboxingJavaNULL
0 likes · 12 min read
Understanding Null in Java: Causes, Behaviors, and Best Practices
Qunar Tech Salon
Qunar Tech Salon
Jan 16, 2015 · Fundamentals

Best Practices for Null‑Safe Programming in Java

To avoid NullPointerException in Java, use string literals with equals, prefer String.valueOf over toString, employ null‑safe libraries like Apache Commons StringUtils, return empty collections instead of null, annotate with @NotNull/@Nullable, prevent unnecessary autoboxing, define sensible defaults, and use Jackson's path method for safe JSON navigation.

Apache CommonsJacksonJava
0 likes · 5 min read
Best Practices for Null‑Safe Programming in Java