Hacker News new | ask | show | jobs
by lern_too_spel 3432 days ago
Use JSR305 with Findbugs or SpotBugs to solve the problem at compile time. Using Optional in Java does have a problem with extra object overhead, so if you want to avoid that, you should use another language like Kotlin or Scala.
1 comments

Scala's Somes cost an object as well, though (I believe) None is free in both Java and Scala.
You're right. Some is not an AnyVal.