Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What method would you use to collect stream elements into a List?
Think about what data structure you want to use to store the elements.
How can you ensure that elements collected from a stream are unique?
What type of collection automatically removes duplicates?
What is the purpose of Stream Collectors?
Think about what you usually do after processing a stream.
True or False: the toSet() collector allows duplicate elements.
What happens when you try to add a duplicate to a Set?
Create a Java program that accepts a list of strings, collects them into a HashSet using toSet(), and then outputs the size of the set.
How do you switch from a List to a Set in your code?
Write a code snippet that groups strings by their initial character and outputs the resulting Map.
What function can you use to determine the initial character?
4 more questions in this section. Enroll free to practise them all.
Enroll free