Opt.ofEmptyAble支持更多类型

This commit is contained in:
Looly
2023-12-15 22:00:15 +08:00
parent 9242ca262b
commit bcc5bc6d6c
2 changed files with 4 additions and 4 deletions

View File

@@ -168,7 +168,7 @@ public class OptTest {
final List<String> hutool = Opt.ofEmptyAble(Collections.<String>emptyList()).orElseGet(() -> Collections.singletonList("hutool"));
Assertions.assertEquals(past, hutool);
Assertions.assertEquals(Collections.singletonList("hutool"), hutool);
Assertions.assertTrue(Opt.ofEmptyAble(Arrays.asList(null, null, null)).isEmpty());
Assertions.assertFalse(Opt.ofEmptyAble(Arrays.asList(null, null, null)).isEmpty());
}
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection", "ConstantConditions"})