There are already Optional use cases in Nacos, so it's time to be careful with this syntax

preface Java 8 provides many new features, but many friends don't pay attention to it and still use the old writing method. Recently, I read a lot of the source code of the open source framework and found that many API s of Java 8 have been used frequently. Taking the Nacos framework as an example, there are already typical Optional use cases ...

Added by rodin on Thu, 17 Feb 2022 10:16:22 +0200

Master six operations of Java 8 Optional

Hello, I'm looking at the mountain. Java 8 introduces a particularly interesting class: Optional, a tool that makes it easier for us to avoid NPE (null pointer exception). A long time ago, in order to avoid NPE, we wrote a lot of code similar to if (obj! = null) {}. Sometimes if we forget to write, NPE may occur and cause online failure. In ...

Added by NeoSsjin on Wed, 09 Feb 2022 06:49:40 +0200