I have an object that looks like this:

Account account = new Account (0, fName, sName, adr, city, pos, uniqueID);I then put that object, via user input, to an ArrayList:

List newSacc= new ArrayList();Here's the problem. I need a slick way to remove that object based on user input. This is what I've tried:

System.out.print("1. Client with Accounts.\n2. Client with Savings Accounts.\n3. Remove all Accounts.\n"); int inputRmv = in.nextInt(); case 1: for (Iterator i = newAcc.iterator(); i.hasNext(); ) { if (i.equals(rmvID)) { newAcc.remove(i);
This doesn't work. The object isn't removed this way.
Basically: is there a way to use user input and then iterate through the list to see if any object contains a string equivalent to any part of the object?
I am in dire need, so any help to send me in the right direction is immensely appreciated!
Cheers.


Check Solution