Stream Collectors QuizJ8 Home « Stream Collectors Quiz

Streams Quiz 9

The quiz below tests your knowledge of the material learnt in Streams - Lesson 9 - Stream Collectors.

Question 1 : Which class has only static methods which are used in stream collectors?
- The <code>Collectors</code> class has only static methods which are used in stream collectors.
Question 2 : The characteristics() method returns a mutable set of Characteristics which define the behaviour of this Collector?
- The <code>characteristics()</code> method returns AN IMMUTABLE set of <code>Characteristics</code> which define the behaviour of this <code>Collector</code>.
Question 3 : Which Collectors method adapts a Collector to perform an additional finishing transformation?
- The <code>collectingAndThen()</code> method of the <code>Collectors</code> adapts a <code>Collector</code> to perform an additional finishing transformation.
Question 4 : The methods of the Collectors class are all static?
- The methods of the <code>Collectors</code> class ARE all static.
Question 5 : Which of these Collector interface methods is not required to execute a sequential reduction of a stream?
- The <code>combiner()</code> interface method is not required to execute a sequential reduction of a stream, as this is used for parallel processing alongside the other methods.
Question 6 : We use a static import for methods of the Collectors class?
- We DO use a static import for methods of the <code>Collectors</code> class as all methods in this class are static.
Question 7 : Characteristics.IDENTITY_FINISH indicates what?
- <code>Characteristics.IDENTITY_FINISH</code> indicates that the <code>supplier()</code> and <code>finisher()</code> methods are the same and so the <code>finisher()</code> method can be left out.
Question 8 : There are two variants of the toMap() method?
- There are THREE variants of the <code>toMap()</code> method.
Quiz Progress Bar Please select an answer


What's Next?

In the next quiz we test your knowledge of collecting & aggregating streams.