Question: Write a program to determine the 100 actors with the most movies, and the number of movies in which they appear. For each movie, produce

Write a program to determine the 100 actors with the most movies, and the number of movies in which they appear. For each movie, produce a map whose keys are the actors, all with value 1. Merge those maps as in Exercise ••• P19.10. Then extract the top 100 actors from a stream of actors.

Data from exercise P19.10

Write a program to determine how many actors there are in the data set in Worked Example 19.2. Note that many actors are in multiple movies. The challenge in this assignment is that each movie has a list of actors, not a single actor, and there is no ready-made collector to form the union of these lists. However, there is another collect method that has three parameters:
• A function to generate an instance of the target • A function to add an element to a target • A function to merge two targets into one for example, stream.collect(() -> 0, (t,e) -> t +e, (t, u) -> t + u) computes the sum of elements in a Stream. Note that the last function is only needed for parallel streams.
Define methods for generating a set, adding a list of actors into one, and for combining two sets.

Step by Step Solution

3.46 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Based on your question I believe you are asking for a Java program that can analyze a data set containing movies where each movie is linked to a list ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!