Strange UnsupportedOperationException when calling list.remove(0)

后端 未结 5 1529
故里飘歌
故里飘歌 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:30

    The returned list acts as a view for the backed array. You can not modify the list directly but only through the backed array. However, you cannot resize the array.

提交回复
热议问题