---
title: "Comment by Shai Almog on \"Dear Student, how to avoid null verifications in Java\" | Hashnode"
description: "That&#39;s an option ;-) Notice that optional isn&#39;t &quot;free&quot; and carries an overhead on top of null . It&#39;s not a big deal but personally I like"
url: "https://hashnode.com/posts/dear-student-how-to-avoid-null-verifications-in-java/618a69e5468c06249afc4ad2/comment/618a942b468c06249afc4f3f"
---

[Discussion](https://hashnode.com/posts/dear-student-how-to-avoid-null-verifications-in-java/618a69e5468c06249afc4ad2)

Comment [Dear Student, how to avoid null verifications in Java](https://hashnode.com/posts/dear-student-how-to-avoid-null-verifications-in-java/618a69e5468c06249afc4ad2)

[Shai Almog](https://hashnode.com/@talktotheduck)

[Nov 9, 2021](https://hashnode.com/posts/dear-student-how-to-avoid-null-verifications-in-java/618a69e5468c06249afc4ad2/comment/618a942b468c06249afc4f3f)

That's an option ;-)

Notice that optional isn't "free" and carries an [overhead on top of null](https://pkolaczk.github.io/overhead-of-optional/) .

It's not a big deal but personally [I like null](https://twitter.com/debugagent/status/1457664209446113285) .

[Andres Pastorini](https://hashnode.com/@apastorini)

[Nov 9, 2021](https://hashnode.com/posts/dear-student-how-to-avoid-null-verifications-in-java/618a69e5468c06249afc4ad2/comment/618a942b468c06249afc4f3f#reply-618aa277f991b025366dfe25)

Shai, You are right, it is true what you say, and thanks for share it.

I think if the performance is not important, Optional could be a good way, helping to reduce the size of the code and a interesting design pattern to improve the maintainability.
