{"published":"2014-03-27 15:38:36","provider_url":"https://hatena.blog","url":"https://groovy789.hateblo.jp/entry/2014/03/27/153836","blog_title":"groovy789's blog","categories":["java"],"blog_url":"https://groovy789.hateblo.jp/","width":"100%","title":"","height":"190","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fgroovy789.hateblo.jp%2Fentry%2F2014%2F03%2F27%2F153836\" title=\" - groovy789&#39;s blog\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_name":"Hatena Blog","version":"1.0","author_name":"groovy789","author_url":"https://blog.hatena.ne.jp/groovy789/","type":"rich","image_url":null,"description":"\u5f15\u304d\u7d9a\u304djava8\u3067\u3082(\u00b4\u30fb\u03c9\u30fb`) java8\u3067\u5c0e\u5165\u3055\u308c\u305fOptional\u3092\u3061\u3087\u3063\u3068\u8a66\u3059\u3002 public class Sample { public static void main(String[] args) { // \u5024\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb Optional<String> o = Optional.of(\"test\"); // \u5024\u53d6\u5f97\u306e\u5834\u5408\u306f\u3001null\u30c1\u30a7\u30c3\u30af\u304c\u5fc5\u8981 if (o.isPresent()) { System.out.println(o.get()); } // \u30af\u30ed\u30fc\u30b8\u30e3\u3067 o.ifPresent(s -> System.out.println(s)); // \u2026"}