Is there a real reason to use Optional.of()?
问题 I've read here why Optional.of() should be used over Optional.ofNullable() , but the answer didn't satisfy me at all, so I ask slightly different: If you are SURE that your method does not return null , why should you use Optional at all? As far as I know, the more or less only purpose of it is to remind the "user of a method", that he might have to deal with null -values. If he does not have to deal with null -values, why should he be bothered with an Optional ? I ask, because I recently