Guest User

Untitled

a guest
Dec 10th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. List<String> list = new ArrayList<String>;
  2.  
  3. public void myMethod(){
  4.         List<String> removals = new ArrayList<String>(list.size());
  5.     for (String s : list) {
  6.         removals.add(stringMethod(s));
  7.     }
  8.         list.removeAll(removals);
  9. }
  10.  
  11. public void stringMethod(s) {
  12.     if (condition) {
  13.         for (String s1 : list) { //concurrentmodificationexception on this line
  14.             if (s1 == s) {
  15.                 continue;
  16.             }
  17.             //do stuff
  18.         }
  19.     }
  20.         return s;
  21. }
Add Comment
Please, Sign In to add comment