title: Both List and ArrayList remove method doesn't work
body: <p>Today I have an even more stupid problem than yesterday but I really can't understand why my code doesn't work.</p>
  
  <p>The code is the following:</p>
  
  <pre><code>public class A{
      List fileList;
  
      public A(List fl){
          fileList = new ArrayList&lt;String&gt;;
          if(fl != null) {
              fileList = fl;
          }
      }
  
      public void removeFiles(List fl){
          for(Object obj : fl) {
              fileList.remove(obj.toString());
          }
      }
  }
  </code></pre>
  
  <p>I tried every single things I found on the web even with an <code>Iterator</code> but no file has been removed and no errors or exceptions comes up!</p>
  
  <blockquote>
    <p>Some more code</p>
  </blockquote>
  
  <pre><code>public class CoordinationServer extends Activatable implements CoordinationSerInt
  {
  List&lt;CoordObj&gt; userList;
  public int updateFileList(String username, List files, int option) throws RemoteException{
      for (CoordObj anUserList : userList) {
          if (anUserList.getUsername().equals(username)) {
              if(option == 0){
                  anUserList.setFileList(files);
                  return 1;
  
              }else if(option == 1){
                  anUserList.addFilesToList(files);
                  return 1;
  
              }else if(option == 2){
                  anUserList.removeFiles(files);
                  return 1;
              }
              return 0;
          }
      }
      return -1;
  }
  }
  
  public class CoordObj implements Serializable
  {
  UserForUser userReference;
  List fileList;
  String username;
  
  public CoordObj(UserForUser ur, List fl, String un) {
    userReference = ur;
    fileList = new ArrayList&lt;String&gt;();
    if(fl != null)
      fileList = fl;
    username = un;
  }
  
  public void removeFiles(List fl){
    this.fileList.removeAll(fl);
  }
  }
  </code></pre>
  
  <p><strong>RESOLVED</strong>
  If someone else has this problem I resolved it in this way:</p>
  
  <pre><code>fileList.removeAll(Arrays.asList(fl.toArray()));
  </code></pre>