String[] adds elements after converting List

String[] s = {"1","2","3"};

List<String> l = Arrays.asList(str);

Arrays.asList() can convert String[] to List collection, but cannot be deleted after conversion to List collection.

If the add method is performed, it will report

About UnsupportedOperationException

Also convert it

List<String> ls = new ArrayList<String>(l);

ls can add



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326443325&siteId=291194637