Basically, the user submits a String which the Iterator searches an ArrayList for. When found the Iterator will delete the object containing the String.
Because each of these objects contain two Strings, I am finding trouble writing these lines as one.
Friend current = it.next();
String currently = current.getFriendCaption();
Thanks for any help!
You don't need them on one line, just use
remove
to remove an item when it matches:Full demo:
Output: