Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I do not understand how to retrieve this object from the collection using a specified variable. I am trying to retrieve a LinkedInUser with a
I do not understand how to retrieve this object from the collection using a specified variable. I am trying to retrieve a LinkedInUser with a supplied username, but the retrieve method is not working and I have no clue as to why. (I tried using a method from another class called get username to check if there was a username associated with linkedInUser to check if anything was retireved and it just gave a null pointer exception.)
LinkedInUser retrieve (String username); This method returns the LinkedIn user associated with the supplied user name or null if there is no user associated with the supplied user name. D *DeleteUserA... *Serialized... X LinkedInUse... D *User Accoun... D Add UserActio... LinkedInCLI.... D ListUserAct... 53 540 @Override 455 public void saveAll() { 56 try 57 FileOutputStream fos = new FileOutputStream(fileName); 58 ObjectOutputStream oos = new ObjectOutputStream(fos); 59 ) { 60 oos.writeObject(this); 61 oos.close(); 62 fos.close(); 63 } catch (Exception ex) { 64 ex.printStackTrace(); 65 } 66 67 } 68 69 @Override 470 public void delete(LinkedInUser user) { 71 this.users.remove(user); 72 saveAll(); 73 74 } 75 760 @Override -77 public LinkedInUser retrieve(String username) { 78 79 return user; | 80 } 81 82 @Override 483 public ListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started