Q:

Why are Java Optionals immutable?

I'd like to understand why Java 8 Optionals were designed to be immutable.  Is it just for thread-safety?

A:

Optionals are for passing things around.  If you give something to someone and then change its contents, they will be very surprised, and not in a good way.

A:

Optional is considered a value object, and should be immutable to help reduce their ability to make you pull your hair out tracking down a bug at 3am. You can read here for a bit more on the topic:
http://martinfowler.com/bliki/ValueObject.html
http://c2.com/cgi/wiki?ValueObjectsShouldBeImmutable

