1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Java Gold メソッド逆引き早見表 Stream型を返すメソッド 簡略版

Last updated at Posted at 2024-09-09

Stream型を返すメソッド

メソッド名 宣言されたクラス・インターフェイス 戻り値の型(Stream)
of(T... values) Stream Stream<T>
stream(T[] array) Arrays Stream<T>
stream(int[] array) Arrays IntStream
stream(double[]) Arrays DoubleStream
stream(long[]) Arrays LongStream
parallelStream() Collection Stream<T>
generate(Supplier<T> s) Stream Stream<T>
iterate(T seed, UnaryOperator<T> f) Stream Stream<T>
concat(Stream<? extends T> a, Stream<? extends T> b) Stream Stream<T>
ofNullable(T value) Stream Stream<T>
stream() Optional Stream<T>
lines(Path path, Charset cs) Files Stream<String>
list(Path dir) Files Stream<Path>
flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) Stream Stream<R>
map(Function<? super T, ? extends R> mapper) Stream Stream<R>
distinct() Stream Stream<T>
sorted() Stream Stream<T>
sorted(Comparator<? super T> comparator) Stream Stream<T>
peek(Consumer<? super T> action) Stream Stream<T>
skip(long n) Stream Stream<T>
takeWhile(Predicate<? super T> predicate) Stream Stream<T>

プリミティブ型ストリーム関連メソッド (IntStream)

メソッド名 宣言されたクラス・インターフェイス 戻り値の型
of(int... values) IntStream IntStream
range(int startInclusive, int endExclusive) IntStream IntStream
rangeClosed(int startInclusive, int endInclusive) IntStream IntStream
map(IntUnaryOperator mapper) IntStream IntStream
mapToObj(IntFunction<? extends U> mapper) IntStream Stream<U>
flatMap(IntFunction<? extends IntStream> mapper) IntStream IntStream
peek(IntConsumer action) IntStream IntStream
takeWhile(IntPredicate predicate) IntStream IntStream
dropWhile(IntPredicate predicate) IntStream IntStream
concat(IntStream a, IntStream b) IntStream IntStream

補足: プリミティブ型を返すメソッド

メソッド名 宣言されたクラス・インターフェイス 戻り値の型
getAsInt() OptionalInt int
sum() IntStream int
count() IntStream long
count() Stream long
reduce​(int identity, IntBinaryOperator op) IntStream int

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?