Studying Java 8 (Stream)

This time it is Stream. Sample immediately.


 *Studying Stream. Int stream.
 * @author komikcomik
public class StreamSample {
	public static void main(String[] args) {

		//It's like creating a stream and having it do a series of processes inside
		IntStream is = IntStream.of(1000, 123, 456, 1001, 10000, 919, 561, 2000);
		//Extract over 1000 data, sort, then standard output
		is.filter(i -> i >= 1000).sorted().forEach(i -> System.out.println(i));

		//Remove non-single character data → sort → standard output
		Stream<String> strStream = Stream.of("A", "b", "C", "d", "AAA", "BBB", "E");
		strStream.filter(s -> s.length() == 1).sorted().forEach(s -> System.out.println(s));

Execution result


The image was easy to get rid of, but it seems to be quite a problem if I ask if this can be used at the site of pounding.

Recommended Posts

Studying Java 8 (Stream)
Studying Java ―― 3
Studying Java ―― 9
Studying Java ―― 4
Studying Java -5
Studying Java ―― 1
Studying Java # 0
Studying Java ―― 8
Studying Java ②
Studying Java ―― 7
Studying Java ―― 2
Studying Java ①
Studying Java -10
[JAVA] Stream type
Studying java9 (jShell)
Java Stream termination
[Java] Stream processing
Java 9 Optional :: stream
[Java] Stream Collectors notes
Studying Java 8 (Collector / Collectors)
[Java] Stream API-Stream generation
[Java] Stream API / map
Studying Java 8 (see constructor)
Java8 Stream API practice
Studying Java ~ Part 8 ~ Cast
Studying Java 8 (lambda expression)
Java8 Stream Rough Summary
Studying java8 (such as reading a file using Stream)
[Java11] Stream Summary -Advantages of Stream-
Java Stream API cheat sheet
Java Stream API in 5 minutes
Java8 stream, lambda expression summary
[Java] Stream API --Stream termination processing
[Java] Stream API --Stream intermediate processing
Java Stream cannot be reused.
[Java] Introduction to Stream API
Use Redis Stream in Java
[Java11] Stream Usage Summary -Basics-
Java application for beginners: stream
[Java] Stream API intermediate operation
[Java 8] Duplicate deletion (& duplicate check) with Stream
[Java] Stream (filter, map, forEach, reduce)
[java8] To understand the Stream API
About Lambda, Stream, LocalDate of Java8
[Introduction to Java] About Stream API
[Java] Element existence check with Stream
I tried using Java8 Stream API
Studying Java 8 (StaticIF and Default methods)
Basic processing flow of java Stream
Studying Java 8 (String Joiner and join)
Java 8 ~ Stream API ~ to start now
Studying java9 (dropWhile, takeWhile and Stream.ofNullable)
Java array / list / stream mutual conversion list
Java8 list conversion with Stream map
Do you use Stream in Java?
Java learning (0)
[Java] array
Java protected
[Java] Annotation