Question: Q 5 . ( a ) Streams from java.util.stream allow for processing of collections in a way that is declarative, composable, and parallelizable. Explain what
Qa Streams from java.util.stream allow for processing of collections in a way that is declarative, composable, and parallelizable. Explain what is meant by this using examples where appropriate. MARKS b Suppose you have a collection of Car objects ie List cars where a car has the following interface: public interface Car public String getMake; public String getModel; public double getEngineSize; public String getRegistrationNumber; Illustrate using Java code how you would use the Java Streams API to i get a List of the registration numbers of the cars in the collection. MARKS ii Count the number of cars that have an engine size larger than litres. MARKS iii Get a List of three car models that begin with the letter T MARKS iv Prints the cars to the console you can assume that concrete Car classes have an appropriate toString implementation. MARKS
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
