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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # :-: Stream API 一覽 # Stream 接口一覽 ## List 轉 Stream ~~~ // 轉stream list.stream() // 并發處理 list.parallelStream() ~~~ ## filter(過濾) ~~~ Stream<T> filter(Predicate<? super T> predicate); ~~~ ## map(元素轉換) ~~~ <R> Stream<R> map(Function<? super T, ? extends R> mapper); IntStream mapToInt(ToIntFunction<? super T> mapper); LongStream mapToLong(ToLongFunction<? super T> mapper); DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper); ~~~ ## flatMap(元素轉換) ~~~ <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper); IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper); LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper); DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper); ~~~ ## distinct(去除重復,對象需要重寫 equals、hashCode) ~~~ Stream<T> distinct(); ~~~ ## sorted(排序) ~~~ Stream<T> sorted(); Stream<T> sorted(Comparator<? super T> comparator); ~~~ ## peek(生成新的流:流是單向的,例如用于日志打印) ~~~ Stream<T> peek(Consumer<? super T> action); ~~~ ## limit(取前面`n`個元素) ~~~ Stream<T> limit(long maxSize); ~~~ ## skip(跳過`n`個元素) ~~~ Stream<T> skip(long n); ~~~ ## forEach(遍歷) ~~~ void forEach(Consumer<? super T> action); void forEachOrdered(Consumer<? super T> action); ~~~ ## toArray(轉換成數組) ~~~ Object[] toArray(); <A> A[] toArray(IntFunction<A[]> generator); ~~~ ## reduce(結果歸并) ~~~ T reduce(T identity, BinaryOperator<T> accumulator); Optional<T> reduce(BinaryOperator<T> accumulator); <U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner); ~~~ ## collect(轉換成集合) ~~~ <R> R collect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner); <R, A> R collect(Collector<? super T, A, R> collector); ~~~ ## 轉list ~~~ // 轉list Collectors.toList(); // 轉set Collectors.toSet(); // 轉map List<TestVo> testList = new ArrayList<>(10); Map<Long, TestVo> data = releaseList.stream() .collect(Collectors.toMap(TestVo::getId, x -> x)); ~~~ ## count(計數) ~~~ long count(); ~~~ ## 查找 ~~~ boolean anyMatch(Predicate<? super T> predicate); boolean allMatch(Predicate<? super T> predicate); boolean noneMatch(Predicate<? super T> predicate); ~~~ ## 查找 ~~~ Optional<T> findFirst(); Optional<T> findAny(); ~~~
                  <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>

                              哎呀哎呀视频在线观看