阅读背景:

在流中使用option . orelsethrow抛出RuntimeException

来源:互联网 

The following code works fine:

以下代码运行良好:

Stream.of("key1", "key2")
   .map(key -> {
      SomeObject foo = service.find(key);
      if (foo == null) {
         throw new RuntimeException("No entity found with key: " + key);
      }
      return foo;
   })
   // ...
St



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: