Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<String> strList = new ArrayList<>();
- strList.add("Anna");
- strList.add("Ada");
- strList.add("Bob");
- strList.add("Bob");
- List<String> removeList = new ArrayList<>();
- removeList.add("Bob");
- strList.removeAll(removeList);
- for (int i = strList.size() - 1; i > 0; i--) {
- if(strList.get(i).equals("Bob")) strList.remove(i);
- }
- System.out.println(strList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement