Question: Your task is to create a TwitterUser class to represent the users in this dataset. The class should meet the following requirements: Store the user's
Your task is to create a TwitterUser class to represent the users in this dataset. The class should meet the following requirements:
Store the user's id number and who that user has followed
Implement Comparable to sort TwitterUser objects based on id number
Implement Cloneable to make a deep copy of the object
Write a recursive getNeighborhood method similar to the one you developed for the FacebookUser class in Fourth Assignment. The method should take an id number and depth as arguments and return an ArrayList of the users that TwitterUser is following, and who those users are following, and so on up to the requested depth
Include any other methods to the TwitterUser class that are necessary to meet the project requirements
After you have developed the TwitterUser class, create a driver program to do the following:
Read in the information in the data file and store it in a Collection of TwitterUser objects
Unit test your getNeighborhood method
Check that your clone method is creating a deep copy by cloning the first TwitterUserobject id setting the clone's "following" list to empty, and making sure the original object still has the contents of its following list ie you want to make sure that changing an attribute of the clone does not affect the original
Hints:
These data file is quite large, so you will need to be patient. It takes approximately seconds to read in the data file using a Scanner object and an average laptop. Alternatively; you could use a BufferedReader to read it which is more efficient than a Scanner object. The BufferedReader class is described in the Java documentation here:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
