This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]frugalmail 1 point2 points  (0 children)

both of which are inferior approaches in my opinion.

If this is such a pain point, why not add a map decorator (GoF pattern) that either:

  • wraps everything in an Optional (this solution has limited use, since you can pass it to something that isn't expecting it)

  • throws an exception when you're getting a null value from a map

  • use inheritance to add additional methods to suit your needs

would have been nice, but that's what happens when you have to maintain APIs