Question: 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 List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
