Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<String> list = new ArrayList<String>;
- public void myMethod(){
- List<String> removals = new ArrayList<String>(list.size());
- for (String s : list) {
- removals.add(stringMethod(s));
- }
- list.removeAll(removals);
- }
- public void stringMethod(s) {
- if (condition) {
- for (String s1 : list) { //concurrentmodificationexception on this line
- if (s1 == s) {
- continue;
- }
- //do stuff
- }
- }
- return s;
- }
Add Comment
Please, Sign In to add comment