Cleaner, more functional implementation of Robert C Martin's Args program in Clean Code, page 194. This repository is not an endorsement of Robert C Martin's books or views. I found his example to be far too verbose and non-functional for my liking, so I figured I'd rewrite it using Java 8.
Instead of throwing exceptions for missing values, I've opted for returning Optional results, so the client may decide to handle missing values in a more graceful manner.
I wanted to make it 100% immutable, but with as few dependencies as possible. Unfortunately there are no default ImmutableMaps in Java, so ArgsImmutable uses a HashMap under the hood. Once constructed however, Args is entirely read-only.
Unlike the original example, immutable-args does not use null at all - any NullPointerExceptions therefore are entirely the fault of anybody using it. This makes debugging that little bit easier.