If you’re creating Java modules, your module declarations (
module-info.java files) are easily your most important source files. Each one represents an entire JAR and governs how it interacts with other JARs, so take good care of your declarations!
Optional— Nowhere, Somewhere, or Everywhere?
Java 8 introduced
Optional for a very precise use case: to allow the continuation of
Stream pipelines without triggering a
NullPointerException. This is NPE-safe:
Stream.of(2, 4, 6)
In most programming languages empty-or-not-empty types are well-behaved monads. (Yes, I used the M-word — don’t worry, no math.) This means their mechanics fulfill a couple of definitions and follow a number of laws that guarantee safe…