Strange UnsupportedOperationException when calling list.remove(0)

后端 未结 5 1511
故里飘歌
故里飘歌 2021-01-23 17:04

I have this method which takes a varargs of Strings, creates a List out of it, and then tries to remove the first element of the list.

public void importFrom(Str         


        
5条回答
  •  没有蜡笔的小新
    2021-01-23 17:29

    You could just create a new ArrayList(), then loop over all files for (String file : files) fileList.add(file);. Or you could use the List you already created and add it to the new ArrayList using fileList.addAll(files);

提交回复
热议问题