Refactor Optional examples

This commit is contained in:
pivovarit 2016-12-04 13:32:18 +01:00
parent 037acd1ae6
commit dcb7221d29
1 changed files with 0 additions and 7 deletions

View File

@ -66,7 +66,6 @@ public class OptionalTest {
public void givenOptional_whenIfPresentWorks_thenCorrect() {
Optional<String> opt = Optional.of("baeldung");
opt.ifPresent(name -> System.out.println(name.length()));
opt.ifPresent(String::length);
}
// returning Value With get()
@ -185,12 +184,6 @@ public class OptionalTest {
.orElseGet(() -> "john");
assertEquals("john", name);
name = Optional.ofNullable(nullName)
.orElseGet(() -> {
return "doe";
});
assertEquals("doe", name);
}
@Test