Given:
and:
Which code, when inserted on line 10, prints the number of unique localities from the roster list?
Given:
and:
Which code, when inserted on line 10, prints the number of unique localities from the roster list?
To print the number of unique localities from the roster list, the code should transform the stream of Employee objects into a stream of localities, remove duplicates, and then count them. The correct transformation is achieved by using the map method to extract the locality, followed by distinct to remove duplicates, and count to get the number of unique elements. Therefore, option A is correct because it uses map to get the locality of each Employee, distinct to remove duplicates, and count to count the unique localities.
A is true.