[Java] for Each and sorted in Lambda

It's been quite a while since Java 8 came out, but it seems that there are quite a lot of people who do not know how to write lambdas. A guy who uses lambda as a memorandum to Sysout the alphabet Feeling using basic For Each and sorted


	public static void main(String[] args) {
		//Alphabet
		List<String> list = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
				"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
				"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
		//Sysout from the head for the time being
		list.forEach(System.out::println);

		//Sysout with multithreading
		list.parallelStream().forEach(System.out::println);

		//sort(Character code order)And Sysout
		list.stream().sorted().forEach(System.out::println);

		//sort(In alphabetical order(If the alphabet is the same, lowercase → uppercase))And Sysout
		list.stream().sorted(String::compareToIgnoreCase).forEach(System.out::println);
	}

Recommended Posts

[Java] for Each and sorted in Lambda
[Java] Make variables in extended for statement and for Each statement immutable
Enable / disable SNI in Java for each communication
This and that for editing ini in Java. : inieditor-java
Java while and for statements
Store in Java 2D map and turn with for statement
[For beginners] Explanation of classes, instances, and statics in Java
StringUtils.isNotBlank is convenient for empty judgment and null judgment in java
Define abstract methods in Java enum and write each behavior
Tips for using Salesforce SOAP and Bulk API in Java
Processing time measurement for each BCrypt + stretch count in Java
AWS SDK for Java 1.11.x and 2.x
Rock-paper-scissors game for beginners in Java
Java for beginners, expressions and operators 1
Encoding and Decoding example in Java
[For beginners] Run Selenium in Java
Java for beginners, expressions and operators 2
StringBuffer and StringBuilder Class in Java
Understanding equals and hashCode in Java
Settings for SSL debugging in Java
Classes and instances Java for beginners
Hello world in Java and Gradle
Create and integrate Slack App and AWS Lambda (for ruby) in 30 minutes
Implement API Gateway Lambda Authorizer in Java Lambda
Difference between final and Immutable in Java
Duplicate Map sorted by key in Java
First steps for deep learning in Java
Key points for introducing gRPC in Java
Nowadays Java lambda expressions and Stream API
[For beginners] Difference between Java and Kotlin
[Java] Proxy for logging SQL and SQL results
Arrylist and linked list difference in java
Working with huge JSON in Java Lambda
Program PDF headers and footers in Java
Learn Flyweight patterns and ConcurrentHashMap in Java
Java Direction in C ++ Design and Evolution
Java to C and C to Java in Android Studio
Reading and writing gzip files in Java
Difference between int and Integer in Java
Discrimination of Enums in Java 7 and above
Automatically transfer animations for each title and store them in a folder
Comparison of thread implementation methods in Java and lambda expression description method
I wrote a Lambda function in Java and deployed it with SAM
Regarding the transient modifier and serialization in Java
Create barcodes and QR codes in Java PDF
Detect similar videos in Java and OpenCV rev.2
ChatWork4j for using the ChatWork API in Java
For JAVA learning (2018-03-16-01)
Technology for reading Java source code in Eclipse
Partization in Java
Parallel and parallel processing in various languages (Java edition)
I studied for 3 weeks and passed Java Bronze
Difference between next () and nextLine () in Java Scanner
Changes in Java 11
Solution for NetBeans 8.2 not working in Java 9 environment
Rock-paper-scissors in Java
Differences in writing Java, C # and Javascript classes
Impressions and doubts about using java for the first time in Android Studio
Effective Java 3rd Edition Chapter 7 Lambda and Streams
Capture and save from selenium installation in Java
Detect similar videos in Java and OpenCV rev.3