3 ms·
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
by lern_too_spel 10y 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.
- Nullabillity 10y agoScala's Somes cost an object as well, though (I believe) None is free in both Java and Scala.
- lern_too_spel 10y agoYou're right. Some is not an AnyVal.