Question: Using a Stream to Sort Data Instead of using Collections.sort ( ) , do the following: Declare a Stream of String Sort that Stream of
Using a Stream to Sort Data
Instead of using Collections.sort do the following:
Declare a Stream of String
Sort that Stream of String
Print out the new List by converting the Stream of String using the collect with the correct parameter that is a method.
Hint:
sorted can be helpful to sort a Stream
Research Collectors methods that will allow a List to be printed.
Something like: System.out.printlnnameOfStreamOfStringcollectCollectorsmethodName; where methodName is an actual method in Collectors
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
