Looking at your book's table of contents, I see you cover the new Optional class briefly under Streams.
Other languages use similar types (Maybe, Option) as a way to program safely without worrying about null pointers. How realistic do you think it is for Java developers to adopt Optional in practice and move away from using null, given all the existing library methods that return null as a matter of course?
I wouldn’t expect existing libraries to be rewritten using the Optional class. It can be used to create better libraries in the future. One of the nice things about using the Optional class is that it will force you to deal with null values. You will have to actively consider the possibility that a null result may be encounter. This will make your code more stable. Of course this comes with a cost: more time spent developing your code. The payback is arguably better code.
As a specific example, when writing new code, do you think it's worth using Optional.ofNullable( legacyLibraryCall( some, args ) ) to wrap old (possibly null-returning) library calls so that your code can be null-free? Or do you think that it's not worth the effort at that level?