Back to Blog
Headshot of Nemanja Marić

1 minute read

Optional classes in Java

Nemanja Marić

Software Engineer

Handling null values is a common source of bugs in Java, often leading to NullPointerException. Introduced in Java 8, Optional classes provide a type-safe way to represent nullable values, improving code readability and reliability.

In his tutorial, our software engineer, Nemanja Marić, covers how to create and use Optional in Java, including Optional.of, Optional.ofNullable, and Optional.empty.

Working with Optional classes in Java

In his video, Nemanja explores how Optional works in Java, as well as how to create and use it effectively, and finally, how features like ifPresentOrElse, mapping, filtering, and chaining can help you write cleaner and more expressive code.

He demonstrates best practices for retrieving values, using ifPresentOrElse, and chaining operations with map and filter through practical examples.

Follow Nemanja’s channel for more helpful videos, and watch the video below to see practical examples and learn how to avoid common pitfalls when working with null values.

Headshot of Nemanja Marić

Nemanja Marić

Software Engineer

Nemanja Marić is a software engineer with 6 years of hands-on experience in building robust and scalable applications. He holds a BSc in Software Engineering and specializes primarily in Java and Spring. Along the way, he had also explored C#, React, Cloud Computing, and Flutter. He approaches software development with genuine joy and a passion for creating impactful solutions by building scalable, robust, and high-quality software.

Related posts.