Why do I get an UnsupportedOperationException when trying to remove an element from a List?

后端 未结 17 2274
后悔当初
后悔当初 2020-11-22 07:43

I have this code:

public static String SelectRandomFromTemplate(String template,int count) {
   String[] split = template.split(\"|\");
   List         


        
17条回答
  •  甜味超标
    2020-11-22 07:51

    I've got another solution for that problem:

    List list = Arrays.asList(split);
    List newList = new ArrayList<>(list);
    

    work on newList ;)

提交回复
热议问题