<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ### 流異常(Stream Exception) 通過修改**CompletableExceptions.java**,看看 **CompletableFuture**異常與流異常有何不同: ```java // concurrent/StreamExceptions.java import java.util.concurrent.*; import java.util.stream.*; public class StreamExceptions { static Stream<Breakable> test(String id, int failcount) { return Stream.of(new Breakable(id, failcount)) .map(Breakable::work) .map(Breakable::work) .map(Breakable::work) .map(Breakable::work); } public static void main(String[] args) { // No operations are even applied ... test("A", 1); test("B", 2); Stream<Breakable> c = test("C", 3); test("D", 4); test("E", 5); // ... until there's a terminal operation: System.out.println("Entering try"); try { c.forEach(System.out::println); // [1] } catch (Exception e) { System.out.println(e.getMessage()); } } } ``` 輸出結果: ``` Entering try Breakable_C [2] Breakable_C [1] Throwing Exception for C Breakable_C failed ``` 使用 `CompletableFuture`,我們可以看到測試A到E的進展,但是使用流,在你應用一個終端操作之前(e.g. `forEach()`),什么都不會暴露給 Client `CompletableFuture` 執行工作并捕獲任何異常供以后檢索。比較這兩者并不容易,因為 `Stream` 在沒有終端操作的情況下根本不做任何事情——但是流絕對不會存儲它的異常。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看