安全消费值
小于 1 分钟函数式编程Optional
ifPresent方法
public static void main(String[] args) {
Optional<Author> author = getAuthor();
author.ifPresent(a -> System.out.println(a.getName()));
}
ifPresent方法
public static void main(String[] args) {
Optional<Author> author = getAuthor();
author.ifPresent(a -> System.out.println(a.getName()));
}