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

后端 未结 17 1974
后悔当初
后悔当初 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 08:06

    I think that replacing:

    List list = Arrays.asList(split);
    

    with

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

    resolves the problem.

提交回复
热议问题