You are on page 1of 1

It is desired to group some persons from the yellow pages according to the company

they work for.


Implement the Company class which has a name, the foundation year, a list of
persons, an enum specifing the company area(IT, FINANCE..) and other attributes at
your liking.
Create a list of companies, each containg a list of Person instances.

1. List the names of all companies.


2. Transform one of the object's property into a primitive stream and do some
processing on it.
3. Find the oldest company based on the foundation year.
4. Count the persons in the stream using map() and reduce().
5. Use reduce() to create a Person instance that has the name created as a
concatenation of all the other persons' names.
6. Transform a stream of companies in one of persons, in this way printing all the
persons that are employed.
7. Display the unique persons using distinct(). Two persons are considered to be
identical if they have the same phone number.
8. Implement a custom collector and print the results of applying it on a stream.
9. Create a big stream (at least 1000 elements). Use stream and parallelStream and
some processing operations. Measure the results (e.g. "Stream took x seconds /
ParallelStream took y seconds").

You might also like