Benefits of creating a List using Arrays.asList()
This question already has an answer here:
Not being able to call add, remove, etc is the exact difference. If you don't need those methods, Arrays.asList gives you a perfectly fine view of the array as a List (for APIs that take collections rather than arrays). If you need to change the "shape" of the list, then new ArrayList<>(Arrays.asList(myArray)) is the way to go.
链接地址: http://www.djcxy.com/p/2910.html上一篇: 在JavaScript中删除数组元素