{"id":170,"date":"2022-03-19T05:41:40","date_gmt":"2022-03-18T20:41:40","guid":{"rendered":"https:\/\/www.kd2.jp\/memo3\/?p=170"},"modified":"2022-03-23T12:19:55","modified_gmt":"2022-03-23T03:19:55","slug":"supplier","status":"publish","type":"post","link":"https:\/\/www.kd2.jp\/memo3\/?p=170","title":{"rendered":"Supplier"},"content":{"rendered":"<p>\u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30ca\u30eb\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9<\/p>\n<p>Suppiler \u5f15\u6570\u306a\u3057\u30fb\u623b\u308a\u5024\u3042\u308a\u3002<br \/>\nget\u30e1\u30bd\u30c3\u30c9\u306e\u307f\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u3002<br \/>\n\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u7528\u306bBooleanSupplier, IntSupplier, LongSupplier, DoubleSupplier\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u95a2\u6570\u3092\u5909\u6570\u306e\u3088\u3046\u306b\u6271\u3048\u308b\u3002<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">\/\/ Lambda\u5f0f\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u304c0\u500b\u306e\u5834\u5408\u306f\u62ec\u5f27\u3092\u7701\u7565\u3067\u304d\u306a\u3044\u3002\r\nSupplier&lt;Object&gt; sp = () -&gt; LocalDateTime.now().plusHours(-8); \r\nSystem.out.println(sp.get()); \/\/2019-07-06T07:03:53.413\r\nThread.sleep(10000); \/\/ 10\u79d2\u9593\u30b9\u30ea\u30fc\u30d7\u3002\r\nSystem.out.println(sp.get()); \/\/2019-07-06T07:04:03.420<\/pre>\n<\/div>\n<p>\u95a2\u6570\u3092\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u3088\u3046\u306b\u6e21\u305b\u308b\u3002<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">public void doTest1() {\r\n    Supplier&lt;String&gt; mydate = () -&gt; new SimpleDateFormat(\"yyyy\u306d\u3093MM\u304c\u3064dd\u306b\u3061\u3067\u3059\u3088\").format(new Date());\r\n    doTest1Re(mydate);\r\n}\r\npublic void doTest1Re(Supplier&lt;String&gt; mydate) {\r\n    System.out.println(mydate.get());\r\n}<\/pre>\n<\/div>\n<p>\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3067\u306e\u4f7f\u7528\u4f8b\u3002<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">BooleanSupplier csIsMonday = () -&gt; Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY;\r\nSystem.out.println(csIsMonday.getAsBoolean());\r\n\t\t\r\nIntSupplier csYear = () -&gt; Calendar.getInstance().get(Calendar.YEAR);\r\nSystem.out.println(csYear.getAsInt());\r\n\t\t\r\nLongSupplier csYearSquare = () -&gt; Calendar.getInstance().get(Calendar.YEAR) * Calendar.getInstance().get(Calendar.YEAR);\r\nSystem.out.println(csYearSquare.getAsLong());\r\n\t\t\r\nDoubleSupplier csYearPI = () -&gt; Calendar.getInstance().get(Calendar.YEAR) * Math.PI;\r\nSystem.out.println(csYearPI.getAsDouble());<\/pre>\n<\/div>\n<p>\u30e1\u30bd\u30c3\u30c9\u53c2\u7167\u3067\u306e\u4f7f\u7528\u4f8b<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">Supplier&lt;Object&gt; cs = Instant::now;\r\nSystem.out.println(cs.get());<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30ca\u30eb\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9 Suppiler \u5f15\u6570\u306a\u3057\u30fb\u623b\u308a\u5024\u3042\u308a\u3002 get\u30e1\u30bd\u30c3\u30c9\u306e\u307f\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u3002 \u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u7528\u306bBooleanSupplier, IntSupplier, LongSupplier, D&hellip; <a class=\"more-link\" href=\"https:\/\/www.kd2.jp\/memo3\/?p=170\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">Supplier<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,3,10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts\/170"}],"collection":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=170"}],"version-history":[{"count":10,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts\/170\/revisions"}],"predecessor-version":[{"id":212,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts\/170\/revisions\/212"}],"wp:attachment":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}