This commit is contained in:
Looly
2021-11-16 00:38:10 +08:00
parent e7370ef77c
commit a16b0ed025
2 changed files with 10 additions and 6 deletions

View File

@@ -149,7 +149,7 @@ public class OptTest {
@Test
public void ofEmptyAbleTest() {
// 以前输入一个CollectionUtil感觉要命类似前缀的类一大堆代码补全形同虚设(在项目中起码要输入完CollectionU才能在第一个调出这个函数)
// 以前输入一个CollectionUtil感觉要命类似前缀的类一大堆代码补全形同虚设(在项目中起码要输入完CollectionUtil才能在第一个调出这个函数)
// 关键它还很常用,判空和判空集合真的太常用了...
List<String> past = Opt.ofNullable(Collections.<String>emptyList()).filter(CollectionUtil::isNotEmpty).orElseGet(() -> Collections.singletonList("hutool"));
// 现在一个ofEmptyAble搞定
@@ -165,6 +165,7 @@ public class OptTest {
Assert.assertEquals("HUTOOL", hutool);
}
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection", "ConstantConditions"})
@Test
public void execTest() {
// 有一些资深的程序员跟我说你这个lambda双冒号语法糖看不懂...