<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### 檢查性異常 `CompletableFuture` 和 `parallel Stream` 都不支持包含檢查性異常的操作。相反,你必須在調用操作時處理檢查到的異常,這會產生不太優雅的代碼: ```java // concurrent/ThrowsChecked.java import java.util.stream.*; import java.util.concurrent.*; public class ThrowsChecked { class Checked extends Exception {} static ThrowsChecked nochecked(ThrowsChecked tc) { return tc; } static ThrowsChecked withchecked(ThrowsChecked tc) throws Checked { return tc; } static void testStream() { Stream.of(new ThrowsChecked()) .map(ThrowsChecked::nochecked) // .map(ThrowsChecked::withchecked); // [1] .map( tc -> { try { return withchecked(tc); } catch (Checked e) { throw new RuntimeException(e); } }); } static void testCompletableFuture() { CompletableFuture .completedFuture(new ThrowsChecked()) .thenApply(ThrowsChecked::nochecked) // .thenApply(ThrowsChecked::withchecked); // [2] .thenApply( tc -> { try { return withchecked(tc); } catch (Checked e) { throw new RuntimeException(e); } }); } } ``` 如果你試圖像使用 `nochecked()` 那樣使用` withchecked()` 的方法引用,編譯器會在 `[1]` 和 `[2]` 中報錯。相反,你必須寫出lambda表達式(或者編寫一個不會拋出異常的包裝器方法)。
                  <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>

                              哎呀哎呀视频在线观看