{"id":91401,"date":"2026-08-07T21:16:43","date_gmt":"2026-08-07T13:16:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/91401.html"},"modified":"2026-08-07T21:16:43","modified_gmt":"2026-08-07T13:16:43","slug":"java-%e5%87%bd%e6%95%b0%e5%bc%8f%e7%bc%96%e7%a8%8b%e5%85%a8%e9%98%b6%e7%ac%94%e8%ae%b0%ef%bc%9a%e4%bb%8e%e5%b0%8f%e7%99%bd%e5%88%b0%e4%b8%93%e5%ae%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/91401.html","title":{"rendered":"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6"},"content":{"rendered":"<p>\u51fd\u6570\u5f0f\u63a5\u53e3\u4f5c\u4e3aJava8\u65b0\u7279\u6027\u800c\u8a00\u786e\u5b9e\u65b0&#xff0c;\u4f46\u662fJava8\u5df2\u7ecf\u4e0d\u65b0\u4e86\u3002<\/p>\n<p>\u672c\u6587\u4e3b\u8981\u5e26\u4f60\u4ece\u5165\u95e8\u5230\u4e13\u5bb6&#xff0c;\u5168\u9762\u4e86\u89e3\u51fd\u6570\u5f0f\u7f16\u7a0b\u3002&#xff08;\u5176\u5b9e\u4e3b\u8981\u662f\u81ea\u5df1\u590d\u4e60\u4e00\u4e0b&#xff09;<\/p>\n<p>\u5b66\u4e60\u8def\u5f84&#xff1a;\u5165\u95e8\u7bc7&#xff08;\u770b\u61c2\u4f1a\u5199&#xff09;\u2192 \u8fdb\u9636\u7bc7&#xff08;\u719f\u7ec3\u907f\u5751&#xff09;\u2192 \u4e13\u5bb6\u7bc7&#xff08;\u5e95\u5c42\u539f\u7406&#xff09;<\/p>\n<h3>\u5165\u95e8\u7bc7&#xff1a;\u4ece\u96f6\u770b\u61c2\u51fd\u6570\u5f0f\u7f16\u7a0b<\/h3>\n<p>\u76ee\u6807&#xff1a;\u7406\u89e3\u6838\u5fc3\u6982\u5ff5&#xff0c;\u80fd\u5199\u57fa\u7840\u7684 Lambda \u548c Stream \u4ee3\u7801<\/p>\n<h4>1. \u4ec0\u4e48\u662f\u51fd\u6570\u5f0f\u63a5\u53e3&#xff1f;<\/h4>\n<p>1.1 \u5927\u767d\u8bdd\u5b9a\u4e49<\/p>\n<p>\u51fd\u6570\u5f0f\u63a5\u53e3\u672c\u8d28\u4e0a\u5c31\u662f\u53ea\u6709\u4e00\u4e2a\u62bd\u8c61\u65b9\u6cd5\u7684\u63a5\u53e3\u3002 \u5b83\u7684\u6838\u5fc3\u4f5c\u7528\u662f&#xff1a;\u628a \u201c\u4e00\u6bb5\u4ee3\u7801\u903b\u8f91\u201d \u5f53\u6210\u53c2\u6570\u4f20\u6765\u4f20\u53bb&#xff0c;\u5c31\u50cf\u4f20\u6570\u5b57\u3001\u4f20\u5b57\u7b26\u4e32\u4e00\u6837\u81ea\u7136\u3002\u8fd9\u662f Java \u652f\u6301 \u201c\u51fd\u6570\u5f0f\u7f16\u7a0b\u201d \u7684\u57fa\u7840\u3002<\/p>\n<p>1.2 \u4e3a\u4ec0\u4e48\u9700\u8981\u5b83&#xff1f;\u2014\u2014 \u4ece\u5197\u4f59\u5230\u7b80\u6d01<\/p>\n<p>\u5728\u6ca1\u6709 Lambda \u4e4b\u524d&#xff0c;\u6211\u4eec\u60f3\u7ed9\u65b9\u6cd5\u4f20\u4e00\u6bb5\u903b\u8f91&#xff0c;\u53ea\u80fd\u7528\u300c\u533f\u540d\u5185\u90e8\u7c7b\u300d&#xff0c;\u5199\u6cd5\u975e\u5e38\u5570\u55e6&#xff1a;<\/p>\n<p>java<\/p>\n<p>\/\/ \u65e7\u5199\u6cd5&#xff1a;\u533f\u540d\u5185\u90e8\u7c7b\u5b9e\u73b0 Runnable<br \/>\nRunnable task &#061; new Runnable() {<br \/>\n    &#064;Override<br \/>\n    public void run() {<br \/>\n        System.out.println(&#034;\u6267\u884c\u4efb\u52a1&#034;);<br \/>\n    }<br \/>\n};<br \/>\nnew Thread(task).start();<\/p>\n<p>\u6709\u4e86 Lambda \u4e4b\u540e&#xff0c;\u56e0\u4e3a Runnable \u5c31\u662f\u4e00\u4e2a\u51fd\u6570\u5f0f\u63a5\u53e3&#xff08;\u53ea\u6709\u4e00\u4e2a run() \u65b9\u6cd5&#xff09;&#xff0c;\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u7b80\u5199&#xff1a;<\/p>\n<p>java<\/p>\n<p>\/\/ \u65b0\u5199\u6cd5&#xff1a;Lambda \u8868\u8fbe\u5f0f<br \/>\nRunnable task &#061; () -&gt; System.out.println(&#034;\u6267\u884c\u4efb\u52a1&#034;);<br \/>\nnew Thread(task).start();<\/p>\n<p>1.3 &#064;FunctionalInterface \u6ce8\u89e3<\/p>\n<p>\u5c31\u50cf &#064;Override \u7528\u6765\u6807\u8bb0\u91cd\u5199\u65b9\u6cd5\u4e00\u6837&#xff0c;&#064;FunctionalInterface \u7528\u6765\u6807\u8bb0\u51fd\u6570\u5f0f\u63a5\u53e3\u3002<\/p>\n<ul>\n<li>\u52a0\u4e86\u8fd9\u4e2a\u6ce8\u89e3&#xff0c;\u7f16\u8bd1\u5668\u4f1a\u81ea\u52a8\u68c0\u67e5&#xff1a;\u63a5\u53e3\u662f\u4e0d\u662f\u53ea\u6709\u4e00\u4e2a\u62bd\u8c61\u65b9\u6cd5&#xff0c;\u4e0d\u7b26\u5408\u5c31\u76f4\u63a5\u7f16\u8bd1\u62a5\u9519<\/li>\n<li>\u4e0d\u52a0\u6ce8\u89e3&#xff0c;\u53ea\u8981\u7b26\u5408 \u201c\u5355\u62bd\u8c61\u65b9\u6cd5\u201d \u89c4\u5219&#xff0c;\u4e5f\u7b97\u662f\u51fd\u6570\u5f0f\u63a5\u53e3&#xff0c;\u4f46\u6ca1\u6709\u7f16\u8bd1\u671f\u68c0\u67e5<\/li>\n<\/ul>\n<h4>2. Lambda \u57fa\u7840\u8bed\u6cd5<\/h4>\n<p>Lambda \u8868\u8fbe\u5f0f\u7684\u683c\u5f0f&#xff1a;(\u53c2\u6570) -&gt; { \u65b9\u6cd5\u4f53 }<\/p>\n<ul>\n<li>\u5de6\u8fb9&#xff1a;\u53c2\u6570\u5217\u8868&#xff0c;\u548c\u63a5\u53e3\u65b9\u6cd5\u7684\u53c2\u6570\u5bf9\u5e94<\/li>\n<li>\u53f3\u8fb9&#xff1a;\u65b9\u6cd5\u4f53&#xff0c;\u5199\u5177\u4f53\u7684\u903b\u8f91<\/li>\n<\/ul>\n<p>\u5e38\u89c1\u5199\u6cd5\u7b80\u5316\u89c4\u5219<\/p>\n<li>\u53c2\u6570\u7c7b\u578b\u53ef\u4ee5\u7701\u7565&#xff1a;\u7f16\u8bd1\u5668\u80fd\u6839\u636e\u63a5\u53e3\u63a8\u65ad\u51fa\u6765<\/li>\n<li>\u5355\u53c2\u6570\u53ef\u4ee5\u7701\u7565\u62ec\u53f7&#xff1a;(x) -&gt; &#8230; \u53ef\u5199\u6210 x -&gt; &#8230;<\/li>\n<li>\u5355\u8bed\u53e5\u53ef\u4ee5\u7701\u7565\u5927\u62ec\u53f7\u548c return&#xff1a;\u65b9\u6cd5\u4f53\u53ea\u6709\u4e00\u884c\u65f6&#xff0c;\u4e0d\u7528\u5199 {} \u548c return<\/li>\n<p>java<\/p>\n<p>\/\/ \u5b8c\u6574\u5199\u6cd5<br \/>\nFunction&lt;String, Integer&gt; func &#061; (String s) -&gt; { return s.length(); };<\/p>\n<p>\/\/ \u7b80\u5316\u5199\u6cd5<br \/>\nFunction&lt;String, Integer&gt; func &#061; s -&gt; s.length();<\/p>\n<h4>3. \u56db\u5927\u5e38\u7528\u51fd\u6570\u5f0f\u63a5\u53e3&#xff08;\u5fc5\u987b\u8bb0\u4f4f&#xff09;<\/h4>\n<p>JDK \u5df2\u7ecf\u5e2e\u6211\u4eec\u5b9a\u4e49\u597d\u4e86\u6700\u5e38\u7528\u7684 4 \u79cd\u51fd\u6570\u5f0f\u63a5\u53e3&#xff0c;\u65e5\u5e38\u5f00\u53d1 90% \u7684\u573a\u666f\u90fd\u7528\u5b83\u4eec&#xff1a;<\/p>\n<p>\u8868\u683c<\/p>\n<table>\n<tr>\u63a5\u53e3\u65b9\u6cd5\u7b7e\u540d\u4f5c\u7528\u901a\u4fd7\u7406\u89e3<\/tr>\n<tbody>\n<tr>\n<td>Consumer&lt;T&gt;<\/td>\n<td>void accept(T t)<\/td>\n<td>\u63a5\u6536 1 \u4e2a\u53c2\u6570&#xff0c;\u6ca1\u6709\u8fd4\u56de\u503c<\/td>\n<td>\u201c\u6d88\u8d39\u201d \u4e00\u4e2a\u503c&#xff0c;\u6bd4\u5982\u6253\u5370\u3001\u4fee\u6539<\/td>\n<\/tr>\n<tr>\n<td>Supplier&lt;T&gt;<\/td>\n<td>T get()<\/td>\n<td>\u6ca1\u6709\u53c2\u6570&#xff0c;\u8fd4\u56de\u4e00\u4e2a\u503c<\/td>\n<td>\u201c\u751f\u4ea7\u201d \u4e00\u4e2a\u503c&#xff0c;\u6bd4\u5982\u521b\u5efa\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td>Function&lt;T, R&gt;<\/td>\n<td>R apply(T t)<\/td>\n<td>\u63a5\u6536 T&#xff0c;\u8fd4\u56de R<\/td>\n<td>\u7c7b\u578b\u8f6c\u6362\u3001\u6570\u636e\u6620\u5c04<\/td>\n<\/tr>\n<tr>\n<td>Predicate&lt;T&gt;<\/td>\n<td>boolean test(T t)<\/td>\n<td>\u63a5\u6536 T&#xff0c;\u8fd4\u56de\u5e03\u5c14\u503c<\/td>\n<td>\u6761\u4ef6\u5224\u65ad\u3001\u8fc7\u6ee4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u9010\u4e2a\u4e0a\u624b\u793a\u4f8b<\/p>\n<p>java<\/p>\n<p>\/\/ 1. Consumer&#xff1a;\u6d88\u8d39\u4e00\u4e2a\u5b57\u7b26\u4e32&#xff0c;\u6253\u5370\u5b83<br \/>\nConsumer&lt;String&gt; printer &#061; s -&gt; System.out.println(s);<br \/>\nprinter.accept(&#034;hello&#034;); \/\/ \u8f93\u51fa hello<\/p>\n<p>\/\/ 2. Supplier&#xff1a;\u751f\u4ea7\u4e00\u4e2a\u968f\u673a\u6570<br \/>\nSupplier&lt;Double&gt; random &#061; () -&gt; Math.random();<br \/>\nSystem.out.println(random.get()); \/\/ \u8f93\u51fa\u968f\u673a\u6570<\/p>\n<p>\/\/ 3. Function&#xff1a;\u628a\u5b57\u7b26\u4e32\u8f6c\u6210\u5b83\u7684\u957f\u5ea6<br \/>\nFunction&lt;String, Integer&gt; getLength &#061; s -&gt; s.length();<br \/>\nSystem.out.println(getLength.apply(&#034;abc&#034;)); \/\/ \u8f93\u51fa 3<\/p>\n<p>\/\/ 4. Predicate&#xff1a;\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u4e0d\u662f\u5927\u4e8e3<br \/>\nPredicate&lt;String&gt; isLong &#061; s -&gt; s.length() &gt; 3;<br \/>\nSystem.out.println(isLong.test(&#034;abcd&#034;)); \/\/ \u8f93\u51fa true<\/p>\n<h4>4. \u65b9\u6cd5\u5f15\u7528&#xff1a;Lambda \u7684\u8fdb\u4e00\u6b65\u7b80\u5199<\/h4>\n<p>\u5f53 Lambda \u4f53\u91cc\u53ea\u662f\u8c03\u7528\u4e00\u4e2a\u5df2\u6709\u65b9\u6cd5\u65f6&#xff0c;\u53ef\u4ee5\u7528\u300c\u65b9\u6cd5\u5f15\u7528\u300d\u8fdb\u4e00\u6b65\u7b80\u5316&#xff0c;\u5171\u6709 4 \u79cd&#xff1a;<\/p>\n<p>java<\/p>\n<p>\/\/ 1. \u7c7b\u540d::\u9759\u6001\u65b9\u6cd5<br \/>\nFunction&lt;String, Integer&gt; f1 &#061; Integer::parseInt;<br \/>\n\/\/ \u7b49\u540c\u4e8e&#xff1a;s -&gt; Integer.parseInt(s)<\/p>\n<p>\/\/ 2. \u5bf9\u8c61::\u5b9e\u4f8b\u65b9\u6cd5<br \/>\nConsumer&lt;String&gt; f2 &#061; System.out::println;<br \/>\n\/\/ \u7b49\u540c\u4e8e&#xff1a;s -&gt; System.out.println(s)<\/p>\n<p>\/\/ 3. \u7c7b\u540d::\u5b9e\u4f8b\u65b9\u6cd5&#xff08;\u7b2c\u4e00\u4e2a\u53c2\u6570\u5f53\u65b9\u6cd5\u8c03\u7528\u8005&#xff09;<br \/>\nFunction&lt;String, Integer&gt; f3 &#061; String::length;<br \/>\n\/\/ \u7b49\u540c\u4e8e&#xff1a;s -&gt; s.length()<\/p>\n<p>\/\/ 4. \u7c7b\u540d::new&#xff08;\u6784\u9020\u5668\u5f15\u7528&#xff09;<br \/>\nSupplier&lt;List&lt;String&gt;&gt; f4 &#061; ArrayList::new;<br \/>\n\/\/ \u7b49\u540c\u4e8e&#xff1a;() -&gt; new ArrayList&lt;&gt;()<\/p>\n<h4>5. Stream \u5165\u95e8&#xff1a;\u96c6\u5408\u64cd\u4f5c\u7684 \u201c\u6d41\u6c34\u7ebf\u201d<\/h4>\n<p>5.1 \u4ec0\u4e48\u662f Stream&#xff1f;<\/p>\n<p>Stream \u662f\u7528\u6765\u64cd\u4f5c\u96c6\u5408 \/ \u6570\u7ec4\u7684\u6d41\u6c34\u7ebf\u5de5\u5177&#xff0c;\u4e0d\u7528\u5199 for \u5faa\u73af&#xff0c;\u94fe\u5f0f\u8c03\u7528\u5c31\u80fd\u5b8c\u6210\u8fc7\u6ee4\u3001\u8f6c\u6362\u3001\u6536\u96c6\u7b49\u64cd\u4f5c\u3002<\/p>\n<ul>\n<li>Stream \u4e0d\u662f\u96c6\u5408&#xff0c;\u4e0d\u5b58\u6570\u636e&#xff0c;\u53ea\u8d1f\u8d23 \u201c\u8ba1\u7b97\u201d<\/li>\n<li>\u5c31\u50cf\u5de5\u5382\u6d41\u6c34\u7ebf&#xff1a;\u539f\u6599\u8fdb\u53bb&#xff0c;\u7ecf\u8fc7\u591a\u9053\u5de5\u5e8f&#xff0c;\u6700\u540e\u4ea7\u51fa\u6210\u54c1<\/li>\n<\/ul>\n<p>5.2 \u7b2c\u4e00\u4e2a Stream \u4f8b\u5b50<\/p>\n<p>\u9700\u6c42&#xff1a;\u4ece\u4e00\u4e2a\u5b57\u7b26\u4e32\u5217\u8868\u91cc&#xff0c;\u627e\u51fa\u957f\u5ea6\u5927\u4e8e 3 \u7684&#xff0c;\u8f6c\u6210\u5927\u5199&#xff0c;\u6536\u96c6\u6210\u65b0\u5217\u8868\u3002<\/p>\n<p>\u65e7\u5199\u6cd5&#xff08;for \u5faa\u73af&#xff09;&#xff1a;<\/p>\n<p>java<\/p>\n<p>List&lt;String&gt; list &#061; Arrays.asList(&#034;a&#034;, &#034;abc&#034;, &#034;abcd&#034;, &#034;abcde&#034;);<br \/>\nList&lt;String&gt; result &#061; new ArrayList&lt;&gt;();<br \/>\nfor (String s : list) {<br \/>\n    if (s.length() &gt; 3) {<br \/>\n        result.add(s.toUpperCase());<br \/>\n    }<br \/>\n}<\/p>\n<p>Stream \u5199\u6cd5&#xff1a;<\/p>\n<p>java<\/p>\n<p>List&lt;String&gt; result &#061; list.stream()<br \/>\n        .filter(s -&gt; s.length() &gt; 3)  \/\/ \u8fc7\u6ee4&#xff1a;\u957f\u5ea6&gt;3<br \/>\n        .map(String::toUpperCase)     \/\/ \u8f6c\u6362&#xff1a;\u8f6c\u5927\u5199<br \/>\n        .collect(Collectors.toList());\/\/ \u6536\u96c6&#xff1a;\u8f6c\u6210List<\/p>\n<h4>6. Optional \u5165\u95e8&#xff1a;\u544a\u522b\u7a7a\u6307\u9488<\/h4>\n<p>Optional \u662f\u4e00\u4e2a \u201c\u88c5\u503c\u7684\u76d2\u5b50\u201d&#xff0c;\u7528\u6765\u660e\u786e\u8868\u793a \u201c\u8fd9\u4e2a\u503c\u53ef\u80fd\u4e3a\u7a7a\u201d&#xff0c;\u907f\u514d\u5230\u5904\u5199 if (obj !&#061; null)\u3002<\/p>\n<p>\u5e38\u7528\u5199\u6cd5&#xff1a;<\/p>\n<p>java<\/p>\n<p>\/\/ \u53ef\u80fd\u4e3a\u7a7a\u7684\u503c<br \/>\nOptional&lt;String&gt; opt &#061; Optional.ofNullable(getName());<\/p>\n<p>\/\/ \u6709\u503c\u5c31\u6253\u5370&#xff0c;\u6ca1\u503c\u4ec0\u4e48\u4e5f\u4e0d\u505a<br \/>\nopt.ifPresent(name -&gt; System.out.println(name));<\/p>\n<p>\/\/ \u6ca1\u503c\u5c31\u8fd4\u56de\u9ed8\u8ba4\u503c<br \/>\nString name &#061; opt.orElse(&#034;\u9ed8\u8ba4\u540d\u5b57&#034;);<\/p>\n<p>\/\/ \u6ca1\u503c\u5c31\u5ef6\u8fdf\u751f\u6210\u9ed8\u8ba4\u503c&#xff08;\u63a8\u8350&#xff0c;\u8282\u7701\u6027\u80fd&#xff09;<br \/>\nString name2 &#061; opt.orElseGet(() -&gt; &#034;\u9ed8\u8ba4\u540d\u5b57&#034;);<\/p>\n<hr \/>\n<h3>\u8fdb\u9636\u7bc7&#xff1a;\u719f\u7ec3\u4f7f\u7528\u4e0e\u6838\u5fc3\u89c4\u5219<\/h3>\n<p>\u76ee\u6807&#xff1a;\u638c\u63e1\u65e5\u5e38\u5f00\u53d1\u5168\u573a\u666f&#xff0c;\u907f\u5f00 90% \u7684\u5e38\u89c1\u5751<\/p>\n<h4>1. Stream \u6838\u5fc3\u7279\u6027\u4e0e\u64cd\u4f5c\u5206\u7c7b<\/h4>\n<p>1.1 \u4e24\u5927\u6838\u5fc3\u7279\u6027<\/p>\n<li>\u60f0\u6027\u6c42\u503c&#xff08;\u61d2\u52a0\u8f7d&#xff09;&#xff1a;\u4e2d\u95f4\u64cd\u4f5c\u53ea\u8bb0\u5f55 \u201c\u8981\u505a\u4ec0\u4e48\u201d&#xff0c;\u4e0d\u4f1a\u7acb\u523b\u6267\u884c&#xff1b;\u53ea\u6709\u9047\u5230\u7ec8\u7aef\u64cd\u4f5c&#xff0c;\u624d\u4f1a\u771f\u6b63\u5f00\u59cb\u8ba1\u7b97<\/li>\n<li>\u4e00\u6b21\u6027\u4f7f\u7528&#xff1a;\u4e00\u4e2a Stream \u8c03\u7528\u8fc7\u7ec8\u7aef\u64cd\u4f5c\u540e\u5c31 \u201c\u7528\u5b8c\u4e86\u201d&#xff0c;\u4e0d\u80fd\u518d\u590d\u7528&#xff0c;\u5426\u5219\u4f1a\u629b IllegalStateException<\/li>\n<p>1.2 \u64cd\u4f5c\u5206\u7c7b<\/p>\n<p>\u8868\u683c<\/p>\n<table>\n<tr>\u7c7b\u578b\u7279\u70b9\u5e38\u89c1\u64cd\u4f5c<\/tr>\n<tbody>\n<tr>\n<td>\u4e2d\u95f4\u64cd\u4f5c<\/td>\n<td>\u60f0\u6027&#xff0c;\u8fd4\u56de\u65b0 Stream&#xff0c;\u4e0d\u89e6\u53d1\u8ba1\u7b97<\/td>\n<td>filter\u3001map\u3001flatMap\u3001distinct\u3001sorted\u3001limit\u3001skip\u3001peek<\/td>\n<\/tr>\n<tr>\n<td>\u7ec8\u7aef\u64cd\u4f5c<\/td>\n<td>\u89e6\u53d1\u8ba1\u7b97&#xff0c;\u6267\u884c\u5b8c Stream \u5c31\u5931\u6548<\/td>\n<td>forEach\u3001collect\u3001reduce\u3001count\u3001findFirst\u3001anyMatch<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>1.3 \u5782\u76f4\u6267\u884c\u6a21\u578b<\/p>\n<p>Stream \u4e0d\u662f \u201c\u6240\u6709\u5143\u7d20\u5148\u8fc7 filter&#xff0c;\u518d\u8fc7 map\u201d&#xff0c;\u800c\u662f\u6bcf\u4e2a\u5143\u7d20\u4f9d\u6b21\u8d70\u5b8c\u6240\u6709\u4e2d\u95f4\u64cd\u4f5c\u3002<\/p>\n<p>java<\/p>\n<p>List.of(&#034;a&#034;, &#034;bb&#034;, &#034;ccc&#034;).stream()<br \/>\n    .filter(s -&gt; {<br \/>\n        System.out.println(&#034;\u8fc7\u6ee4:&#034; &#043; s);<br \/>\n        return s.length() &gt; 1;<br \/>\n    })<br \/>\n    .map(s -&gt; {<br \/>\n        System.out.println(&#034;\u8f6c\u6362:&#034; &#043; s);<br \/>\n        return s.toUpperCase();<br \/>\n    })<br \/>\n    .findFirst();<\/p>\n<p>\u6267\u884c\u987a\u5e8f&#xff1a;\u8fc7\u6ee4:a \u2192 \u8fc7\u6ee4:bb \u2192 \u8f6c\u6362:bb&#xff0c;\u627e\u5230\u7b2c\u4e00\u4e2a\u5c31\u505c\u6b62&#xff0c;ccc \u6839\u672c\u4e0d\u4f1a\u5904\u7406\u3002<\/p>\n<h4>2. \u5e38\u7528 Stream \u64cd\u4f5c\u8be6\u89e3<\/h4>\n<p>2.1 \u4e2d\u95f4\u64cd\u4f5c<\/p>\n<p>java<\/p>\n<p>\/\/ filter&#xff1a;\u8fc7\u6ee4<br \/>\nstream.filter(s -&gt; s.startsWith(&#034;a&#034;));<\/p>\n<p>\/\/ map&#xff1a;\u4e00\u5bf9\u4e00\u8f6c\u6362<br \/>\nstream.map(String::length);<\/p>\n<p>\/\/ flatMap&#xff1a;\u4e00\u5bf9\u591a\u6241\u5e73\u5316&#xff08;\u628a\u6bcf\u4e2a\u5143\u7d20\u62c6\u6210\u591a\u4e2a&#xff0c;\u518d\u5408\u6210\u4e00\u4e2a\u6d41&#xff09;<br \/>\n\/\/ \u6bd4\u5982\u628a [&#034;hello&#034;,&#034;world&#034;] \u62c6\u6210\u5355\u4e2a\u5b57\u7b26<br \/>\nstream.flatMap(s -&gt; Arrays.stream(s.split(&#034;&#034;)));<\/p>\n<p>\/\/ distinct&#xff1a;\u53bb\u91cd<br \/>\nstream.distinct();<\/p>\n<p>\/\/ sorted&#xff1a;\u6392\u5e8f<br \/>\nstream.sorted();<br \/>\nstream.sorted(Comparator.reverseOrder());<\/p>\n<p>\/\/ limit\/skip&#xff1a;\u622a\u53d6\u3001\u8df3\u8fc7<br \/>\nstream.limit(3); \/\/ \u53d6\u524d3\u4e2a<br \/>\nstream.skip(2);  \/\/ \u8df3\u8fc7\u524d2\u4e2a<\/p>\n<p>\/\/ peek&#xff1a;\u8c03\u8bd5\u7528&#xff0c;\u5077\u770b\u5143\u7d20&#xff08;\u4e0d\u8981\u5199\u4e1a\u52a1\u903b\u8f91&#xff01;&#xff09;<br \/>\nstream.peek(System.out::println);<\/p>\n<p>2.2 \u7ec8\u7aef\u64cd\u4f5c<\/p>\n<p>java<\/p>\n<p>\/\/ forEach&#xff1a;\u904d\u5386<br \/>\nstream.forEach(System.out::println);<\/p>\n<p>\/\/ collect&#xff1a;\u6536\u96c6\u6210\u96c6\u5408<br \/>\nstream.collect(Collectors.toList());<br \/>\nstream.collect(Collectors.toSet());<br \/>\nstream.collect(Collectors.toMap(k -&gt; k, v -&gt; v.length()));<\/p>\n<p>\/\/ reduce&#xff1a;\u5f52\u7ea6&#xff0c;\u628a\u6240\u6709\u5143\u7d20\u5408\u6210\u4e00\u4e2a\u503c<br \/>\n\/\/ \u6c42\u548c\u4f8b\u5b50<br \/>\nOptional&lt;Integer&gt; sum &#061; stream.reduce((a, b) -&gt; a &#043; b);<\/p>\n<p>\/\/ count&#xff1a;\u7edf\u8ba1\u6570\u91cf<br \/>\nlong count &#061; stream.count();<\/p>\n<p>\/\/ findFirst\/findAny&#xff1a;\u627e\u5143\u7d20<br \/>\nOptional&lt;String&gt; first &#061; stream.findFirst();<\/p>\n<p>\/\/ anyMatch\/allMatch\/noneMatch&#xff1a;\u5339\u914d\u5224\u65ad<br \/>\nboolean hasLong &#061; stream.anyMatch(s -&gt; s.length() &gt; 5);<\/p>\n<h4>3. Lambda \u53d8\u91cf\u6355\u83b7\u89c4\u5219<\/h4>\n<p>3.1 \u6709\u6548\u6700\u7ec8&#xff08;Effectively Final&#xff09;<\/p>\n<p>Lambda \u53ef\u4ee5\u8bbf\u95ee\u5916\u90e8\u7684\u5c40\u90e8\u53d8\u91cf&#xff0c;\u4f46\u8fd9\u4e2a\u53d8\u91cf\u5fc5\u987b\u662f\u6709\u6548\u6700\u7ec8\u7684 \u2014\u2014 \u4e5f\u5c31\u662f\u521d\u59cb\u5316\u4e4b\u540e\u6ca1\u6709\u88ab\u91cd\u65b0\u8d4b\u503c\u3002<\/p>\n<p>java<\/p>\n<p>int num &#061; 10;<br \/>\nRunnable r &#061; () -&gt; System.out.println(num); \/\/ \u2705 \u6b63\u786e&#xff0c;num \u6ca1\u88ab\u6539\u8fc7<\/p>\n<p>java<\/p>\n<p>int num &#061; 10;<br \/>\nnum &#061; 20;<br \/>\nRunnable r &#061; () -&gt; System.out.println(num); \/\/ \u274c \u7f16\u8bd1\u62a5\u9519<\/p>\n<p>3.2 \u4e3a\u4ec0\u4e48\u8981\u6709\u8fd9\u4e2a\u89c4\u5219&#xff1f;<\/p>\n<p>Lambda \u5e95\u5c42\u4f1a\u628a\u53d8\u91cf\u590d\u5236\u4e00\u4efd\u5230\u81ea\u5df1\u5185\u90e8\u3002\u5982\u679c\u5916\u90e8\u53d8\u91cf\u80fd\u968f\u4fbf\u6539&#xff0c;\u5c31\u4f1a\u51fa\u73b0 \u201c\u5185\u5916\u503c\u4e0d\u4e00\u81f4\u201d \u7684\u95ee\u9898&#xff0c;\u5f15\u53d1\u7ebf\u7a0b\u5b89\u5168\u548c\u8bed\u4e49\u6df7\u4e71\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;\u53ea\u7981\u6b62\u300c\u91cd\u65b0\u8d4b\u503c\u53d8\u91cf\u300d&#xff0c;\u4e0d\u7981\u6b62\u300c\u4fee\u6539\u5bf9\u8c61\u5185\u90e8\u72b6\u6001\u300d<\/p>\n<p>java<\/p>\n<p>List&lt;String&gt; list &#061; new ArrayList&lt;&gt;();<br \/>\nRunnable r &#061; () -&gt; list.add(&#034;ok&#034;); \/\/ \u2705 \u5408\u6cd5&#xff0c;list \u5f15\u7528\u6ca1\u53d8&#xff0c;\u53ea\u662f\u5bf9\u8c61\u5185\u5bb9\u53d8\u4e86<\/p>\n<h4>4. \u9ad8\u9891\u8e29\u5751\u907f\u5751\u6307\u5357<\/h4>\n<p>4.1 peek() \u7edd\u5bf9\u4e0d\u8981\u5199\u4e1a\u52a1\u903b\u8f91<\/p>\n<ul>\n<li>peek \u8bbe\u8ba1\u521d\u8877\u53ea\u662f\u8c03\u8bd5\u6253\u5370<\/li>\n<li>\u5f53\u7ec8\u7aef\u64cd\u4f5c\u662f count() \u4e14\u4e2d\u95f4\u4e0d\u6539\u53d8\u5143\u7d20\u6570\u91cf\u65f6&#xff0c;Stream \u5e93\u4f1a\u76f4\u63a5\u8df3\u8fc7\u904d\u5386&#xff0c;peek \u5b8c\u5168\u4e0d\u6267\u884c<\/li>\n<li>\u5e76\u884c\u6d41\u4e2d peek \u6267\u884c\u987a\u5e8f\u4e0d\u786e\u5b9a<\/li>\n<\/ul>\n<p>4.2 Stream \u4e0d\u80fd\u590d\u7528<\/p>\n<p>java<\/p>\n<p>Stream&lt;String&gt; stream &#061; list.stream();<br \/>\nstream.count();<br \/>\nstream.forEach(System.out::println); \/\/ \u274c \u629b\u51fa IllegalStateException<\/p>\n<p>4.3 \u975e\u5e72\u6270\u539f\u5219<\/p>\n<p>Stream \u6267\u884c\u8fc7\u7a0b\u4e2d&#xff0c;\u4e0d\u80fd\u4fee\u6539\u5e95\u5c42\u6570\u636e\u6e90&#xff0c;\u5426\u5219\u53ef\u80fd\u51fa\u73b0\u5e76\u53d1\u4fee\u6539\u5f02\u5e38\u6216\u4e0d\u786e\u5b9a\u7ed3\u679c\u3002<\/p>\n<p>java<\/p>\n<p>List&lt;String&gt; list &#061; new ArrayList&lt;&gt;(List.of(&#034;a&#034;,&#034;b&#034;));<br \/>\nlist.stream().forEach(s -&gt; list.add(&#034;c&#034;)); \/\/ \u274c \u5371\u9669\u64cd\u4f5c<\/p>\n<p>4.4 orElse \u548c orElseGet \u7684\u533a\u522b<\/p>\n<ul>\n<li>orElse(\u9ed8\u8ba4\u503c)&#xff1a;\u4e0d\u7ba1 Optional \u6709\u6ca1\u6709\u503c&#xff0c;\u90fd\u4f1a\u521b\u5efa\u9ed8\u8ba4\u503c\u5bf9\u8c61<\/li>\n<li>orElseGet(Supplier)&#xff1a;\u53ea\u6709\u6ca1\u503c\u7684\u65f6\u5019\u624d\u4f1a\u6267\u884c\u521b\u5efa\u903b\u8f91<\/li>\n<li>\u5f53\u9ed8\u8ba4\u503c\u521b\u5efa\u6210\u672c\u9ad8\u65f6&#xff0c;\u6c38\u8fdc\u7528 orElseGet<\/li>\n<\/ul>\n<p>4.5 Optional \u7981\u5fcc<\/p>\n<ul>\n<li>\u274c \u4e0d\u8981\u7528 Optional \u5f53\u65b9\u6cd5\u53c2\u6570\u3001\u7c7b\u5b57\u6bb5<\/li>\n<li>\u274c \u4e0d\u8981\u5199 if (opt.isPresent()) { opt.get() }&#xff0c;\u8fd9\u548c\u5224\u7a7a\u6ca1\u533a\u522b<\/li>\n<li>\u2705 \u53ea\u7528\u6765\u5f53\u65b9\u6cd5\u8fd4\u56de\u503c&#xff0c;\u660e\u786e\u544a\u8bc9\u8c03\u7528\u65b9 \u201c\u53ef\u80fd\u4e3a\u7a7a\u201d<\/li>\n<\/ul>\n<h4>5. try-with-resources \u8fdb\u9636<\/h4>\n<p>5.1 \u57fa\u7840\u7528\u6cd5<\/p>\n<p>\u7528\u6765\u81ea\u52a8\u5173\u95ed\u8d44\u6e90&#xff08;\u6d41\u3001\u8fde\u63a5\u7b49&#xff09;&#xff0c;\u4e0d\u7528\u624b\u5199 finally&#xff0c;\u8d44\u6e90\u5fc5\u987b\u5b9e\u73b0 AutoCloseable \u63a5\u53e3\u3002<\/p>\n<p>java<\/p>\n<p>\/\/ Java 7&#043;<br \/>\ntry (InputStream in &#061; new FileInputStream(&#034;a.txt&#034;)) {<br \/>\n    \/\/ \u8bfb\u6587\u4ef6<br \/>\n} \/\/ \u81ea\u52a8\u5173\u95ed in<\/p>\n<p>java<\/p>\n<p>\/\/ Java 9&#043; \u589e\u5f3a&#xff1a;\u53d8\u91cf\u5df2\u7ecf\u662f\u6709\u6548\u6700\u7ec8&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u653e\u8fdb\u53bb<br \/>\nInputStream in &#061; new FileInputStream(&#034;a.txt&#034;);<br \/>\ntry (in) {<br \/>\n    \/\/ \u8bfb\u6587\u4ef6<br \/>\n}<\/p>\n<p>5.2 \u5f02\u5e38\u6291\u5236<\/p>\n<p>\u5982\u679c try \u5757\u629b\u4e86\u5f02\u5e38&#xff0c;close() \u4e5f\u629b\u4e86\u5f02\u5e38&#xff0c;\u4e3b\u5f02\u5e38\u662f\u4e1a\u52a1\u5f02\u5e38&#xff0c;close \u7684\u5f02\u5e38\u4f1a\u88ab\u6291\u5236&#xff0c;\u53ef\u4ee5\u901a\u8fc7 e.getSuppressed() \u83b7\u53d6\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;\u53ea\u6709 try \u5757\u4e5f\u629b\u5f02\u5e38\u65f6\u624d\u4f1a\u6291\u5236&#xff1b;\u5982\u679c try \u5757\u6b63\u5e38\u7ed3\u675f&#xff0c;close \u629b\u7684\u5f02\u5e38\u4f1a\u6b63\u5e38\u5411\u4e0a\u629b\u3002<\/p>\n<hr \/>\n<h3>\u4e13\u5bb6\u7bc7&#xff1a;\u5e95\u5c42\u539f\u7406\u4e0e\u5de5\u7a0b\u9ad8\u9636<\/h3>\n<p>\u76ee\u6807&#xff1a;\u7406\u89e3 JVM \u5e95\u5c42\u5b9e\u73b0&#xff0c;\u638c\u63e1\u6027\u80fd\u8c03\u4f18\u4e0e\u5de5\u7a0b\u89c4\u8303<\/p>\n<h4>1. \u51fd\u6570\u5f0f\u63a5\u53e3 JLS \u89c4\u8303\u4e0e\u7f16\u8bd1\u671f\u673a\u5236<\/h4>\n<p>1.1 SAM \u5224\u5b9a\u4e25\u683c\u89c4\u5219<\/p>\n<p>\u51fd\u6570\u5f0f\u63a5\u53e3\u7684 \u201c\u5355\u62bd\u8c61\u65b9\u6cd5\u201d \u8ba1\u6570\u9075\u5faa\u4ee5\u4e0b\u6392\u9664\u89c4\u5219&#xff1a;<\/p>\n<li>\u4e0e java.lang.Object \u7684 public \u65b9\u6cd5\u7b7e\u540d\u4e00\u81f4\u7684\u62bd\u8c61\u65b9\u6cd5&#xff0c;\u4e0d\u8ba1\u5165&#xff08;\u5982 equals(Object)&#xff09;<\/li>\n<li>default \u65b9\u6cd5\u3001static \u65b9\u6cd5\u4e0d\u8ba1\u5165<\/li>\n<li>\u534f\u53d8\u8fd4\u56de\u7c7b\u578b\u7684\u91cd\u5199\u65b9\u6cd5&#xff0c;\u89c6\u4e3a\u540c\u4e00\u65b9\u6cd5<\/li>\n<p>1.2 \u7f16\u8bd1\u671f\u4e09\u91cd\u5c4f\u969c<\/p>\n<p>\u7f16\u8bd1\u5668\u5728 Lambda \u4e0e\u63a5\u53e3\u5339\u914d\u65f6&#xff0c;\u4f1a\u505a\u4e09\u5c42\u4e25\u683c\u6821\u9a8c&#xff1a;<\/p>\n<li>\u7b7e\u540d\u534f\u53d8\u5339\u914d&#xff1a;\u53c2\u6570\u7c7b\u578b\u517c\u5bb9&#xff0c;\u8fd4\u56de\u503c\u652f\u6301\u534f\u53d8&#xff08;\u5982\u8fd4\u56de String \u53ef\u8d4b\u503c\u7ed9 CharSequence&#xff09;<\/li>\n<li>\u5f02\u5e38\u5951\u7ea6\u517c\u5bb9&#xff1a;Lambda \u629b\u51fa\u7684\u53d7\u68c0\u5f02\u5e38&#xff0c;\u5fc5\u987b\u662f\u63a5\u53e3 throws \u58f0\u660e\u7684\u5b50\u96c6<\/li>\n<li>\u91cd\u8f7d\u6d88\u6b67&#xff1a;\u91cd\u8f7d\u65b9\u6cd5\u4e2d&#xff0c;\u7f16\u8bd1\u5668\u901a\u8fc7\u76ee\u6807\u7c7b\u578b\u53cd\u5411\u63a8\u5bfc\u6700\u5339\u914d\u7684\u7248\u672c&#xff1b;\u63a8\u5bfc\u5931\u8d25\u9700\u663e\u5f0f\u8f6c\u578b\u6216\u7c7b\u578b\u89c1\u8bc1<\/li>\n<p>java<\/p>\n<p>\/\/ \u91cd\u8f7d\u6b67\u4e49\u793a\u4f8b<br \/>\nvoid execute(Runnable r) {}<br \/>\nvoid execute(Callable&lt;?&gt; c) {}<br \/>\n\/\/ execute(() -&gt; {}); \/\/ \u7f16\u8bd1\u9519\u8bef&#xff1a;\u6b67\u4e49<br \/>\nexecute((Runnable) () -&gt; {}); \/\/ \u663e\u5f0f\u8f6c\u578b\u89e3\u51b3<\/p>\n<h4>2. Lambda \u8fd0\u884c\u65f6\u5e95\u5c42\u539f\u7406<\/h4>\n<p>2.1 invokedynamic &#043; LambdaMetafactory<\/p>\n<p>Lambda \u4e0d\u662f\u533f\u540d\u5185\u90e8\u7c7b\u7684\u8bed\u6cd5\u7cd6&#xff0c;\u5e95\u5c42\u57fa\u4e8e JDK 7 \u5f15\u5165\u7684 invokedynamic \u6307\u4ee4&#xff1a;<\/p>\n<li>\u7f16\u8bd1\u65f6&#xff1a;\u751f\u6210\u4e00\u4e2a invokedynamic \u8c03\u7528\u70b9&#xff0c;\u4e0d\u751f\u6210\u65b0\u7c7b<\/li>\n<li>\u8fd0\u884c\u65f6&#xff1a;\u7b2c\u4e00\u6b21\u6267\u884c\u65f6&#xff0c;\u7531 LambdaMetafactory \u52a8\u6001\u751f\u6210\u63a5\u53e3\u5b9e\u73b0\u7c7b\u3001\u521b\u5efa\u5b9e\u4f8b&#xff0c;\u5e76\u7ed1\u5b9a\u8c03\u7528\u70b9<\/li>\n<li>\u540e\u7eed\u6267\u884c&#xff1a;\u76f4\u63a5\u590d\u7528\u5df2\u94fe\u63a5\u7684\u8c03\u7528\u70b9<\/li>\n<p>2.2 \u6355\u83b7\u578b vs \u975e\u6355\u83b7\u578b<\/p>\n<ul>\n<li>\u975e\u6355\u83b7\u578b Lambda&#xff1a;\u4e0d\u5f15\u7528\u5916\u90e8\u53d8\u91cf&#xff0c;JVM \u53ef\u4ee5\u7f13\u5b58\u590d\u7528\u5b9e\u4f8b&#xff08;\u4f46\u4e0d\u4fdd\u8bc1\u5355\u4f8b&#xff0c;\u4e0d\u540c\u8c03\u7528\u70b9\u53ef\u80fd\u751f\u6210\u4e0d\u540c\u7c7b&#xff09;<\/li>\n<li>\u6355\u83b7\u578b Lambda&#xff1a;\u5f15\u7528\u4e86\u5916\u90e8\u53d8\u91cf&#xff0c;\u6bcf\u6b21\u8c03\u7528\u901a\u5e38\u521b\u5efa\u65b0\u5b9e\u4f8b&#xff0c;\u6355\u83b7\u7684\u53d8\u91cf\u4f1a\u4f5c\u4e3a\u5b57\u6bb5\u5b58\u5165\u751f\u6210\u7684\u5bf9\u8c61<\/li>\n<\/ul>\n<p>2.3 JIT \u4f18\u5316\u8fb9\u754c&#xff08;\u4e25\u683c\u533a\u5206\u9636\u6bb5&#xff09;<\/p>\n<p>\u4ee5\u4e0b\u4f18\u5316\u53d1\u751f\u5728 JIT \u7f16\u8bd1\u671f&#xff0c;\u4e0d\u662f LambdaMetafactory \u94fe\u63a5\u9636\u6bb5&#xff0c;\u4e14\u4e0d\u4fdd\u8bc1\u5fc5\u7136\u89e6\u53d1<\/p>\n<li>\u5e38\u91cf\u4f20\u64ad&#xff1a;\u6355\u83b7\u7684\u662f\u7f16\u8bd1\u671f\u5e38\u91cf\u65f6&#xff0c;JIT \u4f1a\u5c06\u5e38\u91cf\u5185\u8054&#xff0c;\u628a\u6355\u83b7\u578b\u9000\u5316\u4e3a\u975e\u6355\u83b7\u578b&#xff0c;\u5b9e\u73b0\u590d\u7528<\/li>\n<li>\u9003\u9038\u5206\u6790&#xff1a;\u5224\u5b9a Lambda \u5b9e\u4f8b\u4e0d\u9003\u9038\u65f6&#xff0c;\u4f1a\u76f4\u63a5\u6d88\u9664\u5bf9\u8c61\u5206\u914d&#xff0c;\u628a\u65b9\u6cd5\u4f53\u5185\u8054\u8c03\u7528<\/li>\n<p>\u26a0\ufe0f \u5de5\u7a0b\u8b66\u793a&#xff1a;\u7edd\u5bf9\u4e0d\u80fd\u4f9d\u8d56 Lambda \u5b9e\u4f8b\u7684 &#061;&#061; \u505a\u4e1a\u52a1\u903b\u8f91&#xff0c;\u8fd9\u662f\u5382\u5546\u5b9e\u73b0\u7ec6\u8282&#xff0c;\u8de8\u7248\u672c \/ \u8de8\u865a\u62df\u673a\u884c\u4e3a\u4e0d\u4e00\u81f4\u3002<\/p>\n<h4>3. Stream \u5e95\u5c42\u6267\u884c\u673a\u5236<\/h4>\n<p>3.1 Spliterator \u6570\u636e\u6e90\u62bd\u8c61<\/p>\n<p>Stream \u5e95\u5c42\u57fa\u4e8e Spliterator&#xff08;\u53ef\u5206\u5272\u8fed\u4ee3\u5668&#xff09;\u4f5c\u4e3a\u6570\u636e\u6e90\u62bd\u8c61&#xff0c;\u6838\u5fc3\u80fd\u529b&#xff1a;<\/p>\n<ul>\n<li>tryAdvance&#xff1a;\u9010\u4e2a\u5904\u7406\u5143\u7d20&#xff0c;\u5b9e\u73b0\u62c9\u6a21\u5f0f\u60f0\u6027\u8fed\u4ee3<\/li>\n<li>trySplit&#xff1a;\u62c6\u5206\u6570\u636e\u6e90&#xff0c;\u4e3a\u5e76\u884c\u6d41\u63d0\u4f9b\u57fa\u7840<\/li>\n<li>\u7279\u5f81\u6807\u8bb0&#xff1a;SIZED&#xff08;\u5df2\u77e5\u5927\u5c0f&#xff09;\u3001SUBSIZED&#xff08;\u5b50\u62c6\u5206\u4e5f\u5df2\u77e5\u5927\u5c0f&#xff09;\u3001ORDERED&#xff08;\u6709\u5e8f&#xff09;\u7b49&#xff0c;\u9a71\u52a8\u5e93\u5c42\u4f18\u5316<\/li>\n<\/ul>\n<p>3.2 \u7ba1\u9053\u6784\u5efa\u4e0e\u6267\u884c<\/p>\n<ul>\n<li>\u4e2d\u95f4\u64cd\u4f5c\u53ea\u6784\u5efa\u53cc\u5411\u94fe\u8868\u5f62\u5f0f\u7684\u64cd\u4f5c\u7ba1\u9053&#xff0c;\u6bcf\u4e2a\u9636\u6bb5\u53ea\u8bb0\u5f55\u4e0b\u6e38\u5f15\u7528<\/li>\n<li>\u7ec8\u7aef\u64cd\u4f5c\u89e6\u53d1\u65f6&#xff0c;\u4ece\u6570\u636e\u6e90\u5f00\u59cb&#xff0c;\u4ee5 tryAdvance \u62c9\u6a21\u5f0f\u9010\u4e2a\u63a8\u9001\u5143\u7d20\u7a7f\u8fc7\u7ba1\u9053<\/li>\n<li>\u77ed\u8def\u64cd\u4f5c\u901a\u8fc7 tryAdvance \u8fd4\u56de false \u7ec8\u6b62\u8fed\u4ee3&#xff0c;\u5b9e\u73b0\u63d0\u524d\u9000\u51fa<\/li>\n<\/ul>\n<p>3.3 count() \u4f18\u5316\u539f\u7406<\/p>\n<p>\u5f53\u6e90\u6d41\u5177\u5907 SIZED \u7279\u5f81&#xff0c;\u4e14\u4e2d\u95f4\u64cd\u4f5c\u4e0d\u6539\u53d8\u5143\u7d20\u6570\u91cf\u65f6&#xff0c;count() \u4f1a\u76f4\u63a5\u8fd4\u56de\u6e90\u6d41\u5927\u5c0f&#xff0c;\u4e0d\u89e6\u53d1\u4efb\u4f55\u5143\u7d20\u904d\u5386&#xff0c;\u8fd9\u4e5f\u662f peek \u4e0d\u6267\u884c\u7684\u6839\u672c\u539f\u56e0&#xff08;\u5e93\u5c42\u4f18\u5316&#xff0c;\u975e JIT&#xff09;\u3002<\/p>\n<h4>4. \u5e76\u884c\u6d41\u6df1\u5ea6\u89e3\u6790<\/h4>\n<p>4.1 \u5e95\u5c42\u67b6\u6784<\/p>\n<ul>\n<li>\u9ed8\u8ba4\u4f7f\u7528 ForkJoinPool.commonPool()&#xff0c;\u9ed8\u8ba4\u5e76\u884c\u5ea6 &#061; CPU \u6838\u5fc3\u6570 &#8211; 1<\/li>\n<li>\u57fa\u4e8e Fork\/Join \u6846\u67b6&#xff1a;\u9012\u5f52\u62c6\u5206\u4efb\u52a1 \u2192 \u591a\u7ebf\u7a0b\u6267\u884c \u2192 \u7ed3\u679c\u5408\u5e76<\/li>\n<\/ul>\n<p>4.2 \u62c6\u5206\u6548\u7387\u5dee\u5f02<\/p>\n<p>\u8868\u683c<\/p>\n<table>\n<tr>\u6570\u636e\u6e90\u62c6\u5206\u6548\u7387\u539f\u56e0<\/tr>\n<tbody>\n<tr>\n<td>ArrayList\u3001\u6570\u7ec4\u3001IntStream.range<\/td>\n<td>\u9ad8<\/td>\n<td>Spliterator \u5177\u5907 SUBSIZED \u7279\u5f81&#xff0c;\u53ef\u5747\u5300\u5bf9\u534a\u62c6\u5206<\/td>\n<\/tr>\n<tr>\n<td>LinkedList\u3001Stream.iterate<\/td>\n<td>\u4f4e<\/td>\n<td>\u65e0\u6cd5\u9884\u4f30\u5143\u7d20\u6570\u91cf&#xff0c;\u62c6\u5206\u7c92\u5ea6\u4e0d\u53ef\u63a7&#xff0c;\u5e76\u884c\u6536\u76ca\u6781\u4f4e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>4.3 \u5e76\u884c\u6d41\u6027\u80fd\u9677\u9631<\/p>\n<li>\u6709\u72b6\u6001\u5168\u91cf\u64cd\u4f5c&#xff1a;distinct()\u3001sorted() \u5728\u5e76\u884c\u6d41\u4e2d\u9700\u8981\u5168\u91cf\u7f13\u51b2\u548c\u7ebf\u7a0b\u540c\u6b65&#xff0c;\u901a\u5e38\u6bd4\u4e32\u884c\u66f4\u6162<\/li>\n<li>\u5c0f\u6570\u636e\u91cf&#xff1a;\u7ebf\u7a0b\u8c03\u5ea6\u5f00\u9500\u5927\u4e8e\u5e76\u884c\u6536\u76ca<\/li>\n<li>\u5171\u4eab\u53ef\u53d8\u72b6\u6001&#xff1a;\u4f1a\u4ea7\u751f\u6570\u636e\u7ade\u4e89&#xff0c;\u7ed3\u679c\u9519\u8bef<\/li>\n<li>IO \u963b\u585e\u4efb\u52a1&#xff1a;\u4f1a\u8017\u5c3d\u5168\u5c40 commonPool&#xff0c;\u62d6\u57ae\u6574\u4e2a\u5e94\u7528<\/li>\n<p>4.4 \u751f\u4ea7\u7ea7\u6700\u4f73\u5b9e\u8df5<\/p>\n<p>\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60\u9694\u79bb\u963b\u585e\u4efb\u52a1&#xff1a;<\/p>\n<p>java<\/p>\n<p>ForkJoinPool customPool &#061; new ForkJoinPool(4);<br \/>\ncustomPool.submit(() -&gt;<br \/>\n    list.parallelStream().map(&#8230;).collect(Collectors.toList())<br \/>\n).get();<br \/>\ncustomPool.shutdown();<\/p>\n<p>\u89c4\u8303\u8bf4\u660e&#xff1a;\u8be5\u7528\u6cd5\u4f9d\u8d56 HotSpot \u5b9e\u73b0\u7ec6\u8282&#xff0c;\u975e Java \u8bed\u8a00\u89c4\u8303\u5f3a\u5236\u4fdd\u8bc1&#xff0c;\u4f46\u76ee\u524d\u662f\u5de5\u4e1a\u754c\u9694\u79bb commonPool \u7684\u6807\u51c6\u65b9\u6848\u3002<\/p>\n<h4>5. \u9ad8\u7ea7\u5951\u7ea6\u4e0e\u5e8f\u5217\u5316<\/h4>\n<p>5.1 Lambda \u5e8f\u5217\u5316\u673a\u5236<\/p>\n<p>Lambda \u672c\u8eab\u4e0d\u5929\u7136\u652f\u6301\u5e8f\u5217\u5316&#xff0c;\u5fc5\u987b\u6ee1\u8db3&#xff1a;<\/p>\n<li>\u76ee\u6807\u51fd\u6570\u5f0f\u63a5\u53e3\u7ee7\u627f Serializable<\/li>\n<li>\u6355\u83b7\u7684\u6240\u6709\u53d8\u91cf\u90fd\u53ef\u5e8f\u5217\u5316 \u5e95\u5c42\u4f1a\u751f\u6210 SerializedLambda \u5143\u6570\u636e\u8fdb\u884c\u4f20\u8f93&#xff0c;\u53cd\u5e8f\u5217\u5316\u65f6\u901a\u8fc7 LambdaMetafactory \u91cd\u5efa\u5b9e\u4f8b&#xff0c;\u800c\u975e\u4f20\u8f93\u5b57\u8282\u7801\u3002<\/li>\n<p>5.2 \u76ee\u6807\u7c7b\u578b\u4e0e\u7c7b\u578b\u63a8\u65ad<\/p>\n<p>Lambda \u672c\u8eab\u6ca1\u6709\u72ec\u7acb\u7c7b\u578b&#xff0c;\u5b8c\u5168\u7531\u4e0a\u4e0b\u6587\u7684\u300c\u76ee\u6807\u7c7b\u578b\u300d\u51b3\u5b9a\u3002\u540c\u4e00\u4e2a Lambda \u5728\u4e0d\u540c\u4e0a\u4e0b\u6587\u53ef\u5bf9\u5e94\u4e0d\u540c\u63a5\u53e3\u7c7b\u578b&#xff0c;\u7f16\u8bd1\u5668\u901a\u8fc7\u76ee\u6807\u7c7b\u578b\u53cd\u5411\u63a8\u5bfc\u53c2\u6570\u3001\u8fd4\u56de\u503c\u7c7b\u578b\u3002<\/p>\n<h4>6. \u7248\u672c\u6f14\u8fdb\u4e0e\u6027\u80fd\u4f18\u5316<\/h4>\n<p>\u8868\u683c<\/p>\n<table>\n<tr>\u7248\u672c\u6838\u5fc3\u589e\u5f3a\u5e95\u5c42\u4ef7\u503c<\/tr>\n<tbody>\n<tr>\n<td>Java 8<\/td>\n<td>Lambda\u3001Stream\u3001Optional \u6b63\u5f0f\u53d1\u5e03<\/td>\n<td>\u51fd\u6570\u5f0f\u7f16\u7a0b\u57fa\u77f3<\/td>\n<\/tr>\n<tr>\n<td>Java 9<\/td>\n<td>Stream.iterate \u6709\u9650\u91cd\u8f7d\u3001Optional \u589e\u5f3a<\/td>\n<td>\u6709\u9650\u6d41\u5e76\u884c\u6027\u80fd\u5927\u5e45\u63d0\u5347<\/td>\n<\/tr>\n<tr>\n<td>Java 10<\/td>\n<td>Optional.orElseThrow () \u65e0\u53c2\u91cd\u8f7d<\/td>\n<td>\u8bed\u4e49\u66f4\u7b80\u6d01<\/td>\n<\/tr>\n<tr>\n<td>Java 11<\/td>\n<td>Lambda \u5f62\u53c2\u652f\u6301 var<\/td>\n<td>\u7edf\u4e00\u7c7b\u578b\u63a8\u65ad\u8bed\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>Java 16<\/td>\n<td>Stream.mapMulti<\/td>\n<td>\u66ff\u4ee3 flatMap \u9ad8\u9891\u573a\u666f&#xff0c;\u51cf\u5c11 Stream \u5bf9\u8c61\u5f00\u9500<\/td>\n<\/tr>\n<tr>\n<td>Java 21<\/td>\n<td>\u865a\u62df\u7ebf\u7a0b<\/td>\n<td>\u7ed3\u5408\u51fd\u6570\u5f0f\u63a5\u53e3\u5927\u5e45\u63d0\u5347 IO \u5bc6\u96c6\u578b\u5e76\u53d1\u541e\u5410\u91cf<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>7. \u4e00\u53e5\u8bdd\u6838\u5fc3\u5b9a\u8bba<\/h4>\n<p>\u51fd\u6570\u5f0f\u63a5\u53e3 &#061; SAM \u5951\u7ea6 &#043; \u7f16\u8bd1\u671f\u4e09\u91cd\u6821\u9a8c &#043; invokedynamic \u8fd0\u884c\u65f6\u7ed1\u5b9a &#043; \u6709\u6548\u6700\u7ec8\u503c\u6355\u83b7<\/p>\n<p>Stream &#061; Spliterator \u6570\u636e\u6e90\u62bd\u8c61 &#043; \u60f0\u6027\u4e2d\u95f4\u7ba1\u9053 &#043; \u5782\u76f4\u77ed\u8def\u6267\u884c &#043; \u975e\u5e72\u6270\u539f\u5219<\/p>\n<p>\u73b0\u4ee3 Java \u51fd\u6570\u5f0f\u4f53\u7cfb &#061; \u884c\u4e3a\u89e3\u8026\u80fd\u529b &#043; \u96c6\u5408\u6d41\u5f0f\u62bd\u8c61 &#043; \u7a7a\u5b89\u5168\u4e0e\u5f02\u5e38\u673a\u5236&#xff0c;\u4e09\u8005\u5171\u540c\u6784\u6210\u4e86 Java \u9762\u5411\u73b0\u4ee3\u5f00\u53d1\u7684\u6838\u5fc3\u7f16\u7a0b\u8303\u5f0f\u3002<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u51fd\u6570\u5f0f\u63a5\u53e3\u4f5c\u4e3aJava8\u65b0\u7279\u6027\u800c\u8a00\u786e\u5b9e\u65b0&#xff0c;\u4f46\u662fJava8\u5df2\u7ecf\u4e0d\u65b0\u4e86\u3002\u672c\u6587\u4e3b\u8981\u5e26\u4f60\u4ece\u5165\u95e8\u5230\u4e13\u5bb6&#xff0c;\u5168\u9762\u4e86\u89e3\u51fd\u6570\u5f0f\u7f16\u7a0b\u3002&#xff08;\u5176\u5b9e\u4e3b\u8981\u662f\u81ea\u5df1\u590d\u4e60\u4e00\u4e0b&#xff09;\u5b66\u4e60\u8def\u5f84&#xff1a;\u5165\u95e8\u7bc7&#xff08;\u770b\u61c2\u4f1a\u5199&#xff09;\u2192 \u8fdb\u9636\u7bc7&#xff08;\u719f\u7ec3\u907f\u5751&#xff09;\u2192 \u4e13\u5bb6\u7bc7&#xff08;\u5e95\u5c42\u539f\u7406&#xff09;\u5165\u95e8\u7bc7&#xff1a;\u4ece\u96f6\u770b\u61c2\u51fd\u6570\u5f0f\u7f16\u7a0b\u76ee\u6807&#xff1a;\u7406\u89e3\u6838\u5fc3\u6982\u5ff5&#xff0c;\u80fd\u5199\u57fa\u7840\u7684 Lambda <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10336,305],"topic":[],"class_list":["post-91401","post","type-post","status-publish","format-standard","hentry","category-server","tag-10336","tag-305"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/91401.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u51fd\u6570\u5f0f\u63a5\u53e3\u4f5c\u4e3aJava8\u65b0\u7279\u6027\u800c\u8a00\u786e\u5b9e\u65b0&#xff0c;\u4f46\u662fJava8\u5df2\u7ecf\u4e0d\u65b0\u4e86\u3002\u672c\u6587\u4e3b\u8981\u5e26\u4f60\u4ece\u5165\u95e8\u5230\u4e13\u5bb6&#xff0c;\u5168\u9762\u4e86\u89e3\u51fd\u6570\u5f0f\u7f16\u7a0b\u3002&#xff08;\u5176\u5b9e\u4e3b\u8981\u662f\u81ea\u5df1\u590d\u4e60\u4e00\u4e0b&#xff09;\u5b66\u4e60\u8def\u5f84&#xff1a;\u5165\u95e8\u7bc7&#xff08;\u770b\u61c2\u4f1a\u5199&#xff09;\u2192 \u8fdb\u9636\u7bc7&#xff08;\u719f\u7ec3\u907f\u5751&#xff09;\u2192 \u4e13\u5bb6\u7bc7&#xff08;\u5e95\u5c42\u539f\u7406&#xff09;\u5165\u95e8\u7bc7&#xff1a;\u4ece\u96f6\u770b\u61c2\u51fd\u6570\u5f0f\u7f16\u7a0b\u76ee\u6807&#xff1a;\u7406\u89e3\u6838\u5fc3\u6982\u5ff5&#xff0c;\u80fd\u5199\u57fa\u7840\u7684 Lambda\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/91401.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-07T13:16:43+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91401.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/91401.html\",\"name\":\"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-07T13:16:43+00:00\",\"dateModified\":\"2026-08-07T13:16:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/91401.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/91401.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91401.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/91401.html","og_locale":"zh_CN","og_type":"article","og_title":"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u51fd\u6570\u5f0f\u63a5\u53e3\u4f5c\u4e3aJava8\u65b0\u7279\u6027\u800c\u8a00\u786e\u5b9e\u65b0&#xff0c;\u4f46\u662fJava8\u5df2\u7ecf\u4e0d\u65b0\u4e86\u3002\u672c\u6587\u4e3b\u8981\u5e26\u4f60\u4ece\u5165\u95e8\u5230\u4e13\u5bb6&#xff0c;\u5168\u9762\u4e86\u89e3\u51fd\u6570\u5f0f\u7f16\u7a0b\u3002&#xff08;\u5176\u5b9e\u4e3b\u8981\u662f\u81ea\u5df1\u590d\u4e60\u4e00\u4e0b&#xff09;\u5b66\u4e60\u8def\u5f84&#xff1a;\u5165\u95e8\u7bc7&#xff08;\u770b\u61c2\u4f1a\u5199&#xff09;\u2192 \u8fdb\u9636\u7bc7&#xff08;\u719f\u7ec3\u907f\u5751&#xff09;\u2192 \u4e13\u5bb6\u7bc7&#xff08;\u5e95\u5c42\u539f\u7406&#xff09;\u5165\u95e8\u7bc7&#xff1a;\u4ece\u96f6\u770b\u61c2\u51fd\u6570\u5f0f\u7f16\u7a0b\u76ee\u6807&#xff1a;\u7406\u89e3\u6838\u5fc3\u6982\u5ff5&#xff0c;\u80fd\u5199\u57fa\u7840\u7684 Lambda","og_url":"https:\/\/www.wsisp.com\/helps\/91401.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-07T13:16:43+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/91401.html","url":"https:\/\/www.wsisp.com\/helps\/91401.html","name":"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-07T13:16:43+00:00","dateModified":"2026-08-07T13:16:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/91401.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/91401.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/91401.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Java \u51fd\u6570\u5f0f\u7f16\u7a0b\u5168\u9636\u7b14\u8bb0\uff1a\u4ece\u5c0f\u767d\u5230\u4e13\u5bb6"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=91401"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91401\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=91401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=91401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=91401"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=91401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}