<div dir="ltr">Hi there.<div>I have found that `java.util.Optional` is written procedural style and has `ifnonnull`  checks in each method. I propose to refactor `Optional` in accordance to OOP-style. This will eliminates all unnecessary `if`-statements, removes duplications and reduces bytecode size more then twice.</div><div><br></div><div>I have two solutions:</div><div>1. Completely dynamic that avoids single static `EMPTY` instance and unchecked casting of each `Optional.empty()`</div><div>2. Preserving original single static `EMPTY` per VM.</div><div><br></div><div>Also there are couple methods that throws NPE due to calling methods on null-objects and requires to add `Objects.requireNonNull(...)`.</div><div><br></div><div>OptionalInt, OptionalDouble, OptionalLong could be refactored same way even with remove of additional boolean variable `isPresent`.</div><div><br></div><div>Since I'm new here any guidance will be helpful.</div><div>Thank you in advance.</div></div>