今天我有一个比昨天更愚蠢的问题,但我真的不明白为什么我的代码不起作用.
代码如下:
public class A{
List fileList;
public A(List fl){
fileList = new ArrayList<String>;
if(fl != null) {
fileList = fl;
}
}
public void removeFiles(List fl){
for(Object obj : fl) {
fileList.remove(obj.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了在网络上发现的每一件事,即使有一个Iterator但没有文件被删除,也没有出现错误或异常!
一些更多的代码
public class CoordinationServer extends Activatable implements CoordinationSerInt
{
List<CoordObj> 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); …Run Code Online (Sandbox Code Playgroud)