Why Optional Should NOT Be Used as a Method Parameter in Java
Many Java developers know about Optional, but it's often used incorrectly. In this video, I explain why using Optional as a method parameter is generally considered a bad practice and why it works much better as a return type. Topics covered: • Why Optional was introduced • Problems with Optional parameters • Additional burden on client code • Null-related pitfalls • Why Optional parameters can still lead to NullPointerExceptions • Recommended alternatives • Using Optional as a return type • Java Optional best practices Code examples included throughout the video. If you're preparing for Java interviews, improving code quality, or learning modern Java best practices, this video is for you. #java #javaprogramming #backend #springboot #cleancode 00:00 Introduction 00:43 Code Walkthrough 01:52 Client Code 02:58 Problems with the Approach 03:41 Demo: Passing Null to Optional Parameter 04:53 Better Alternatives and Fix 06:02 Optional as Return Type 06:23 Not Using Optional as return type - Issues 09:03 Closing Comments

7 Design Patterns EVERY Developer Should Know

How to (Re)start Your Java Journey in 2026

How to Resolve Merge Conflicts in IntelliJ IDEA | Git & GitHub Tutorial

The FULL VIDEO of Trump they didn’t want released

Android 17 sucks. So I put Linux on a phone.

Google's OKF: The Simple Folder Replacing Vector Databases

Spring Boot Thread Starvation Explained Visually | Why Every Service Needs a Timeout | Microservices

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!

Why The Russian Accent Terrifies Everyone

The Craziest AI Pivot yet

Java Interview Question | Java 8 | Optional API | orElse() vs orElseGet() Explained

Leave Windows 11 Idle for 24 Hours and Watch What Happens

Build a Spring Boot JVM Monitoring Dashboard with Prometheus & Grafana | Microservices

Stop Prompting Claude. Use Karpathy's Method Instead.

Should You Still Become a Software Engineer in 2026? GitHub VP

How To Think SO CLEARLY People Assume You're A Genius

Godmother of AI: In 10 Years There Will Be Only 2 Kinds of Workers

How To Become Dangerously Self-Educated (with AI)

Why the US Navy's "Dead" Railgun Just Fired Again

