Package modernfeatures.streams
Class StreamBasicsPrintNamesAlpha
java.lang.Object
modernfeatures.streams.StreamBasicsPrintNamesAlpha
Demonstrates the use of Java 8 Streams and functional interfaces to process a list of names.
This example showcases how to:
- Create a Stream from a List
- Use Predicate for filtering names
- Use Function for mapping/transformation
- Use Consumer for processing/output
- Chain intermediate operations (filter, map, sorted)
- Trigger terminal operation (forEach)
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
StreamBasicsPrintNamesAlpha
public StreamBasicsPrintNamesAlpha()
-
-
Method Details
-
main
Main method demonstrating the stream pipeline:- Create a Stream from a list of names
- Filter names with length greater than 3
- Convert each name to uppercase
- Sort the names alphabetically
- Print each name to the console
- Parameters:
args
- command-line arguments (not used)
-