,Arrays.asList
时间: 2023-10-17 18:31:06 浏览: 153
Arrays.asList是一个用于将数组转换为List的方法。它位于java.util.Arrays类中,不是java.util包下的ArrayList类。该方法的定义是public static List asList(T… a),它接受可变参数T[] a,并返回一个ArrayList对象。这个ArrayList并非java.util包下的ArrayList类,而是Arrays类下的一个静态内部类ArrayList。所以,Arrays.asList方法返回的是一个固定大小的List,不能进行增删操作,只能修改元素的值。此外,由于Arrays.asList返回的List是基于数组的,所以对原数组的修改也会反映在返回的List上。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Arrays.asList() 详解](https://blog.csdn.net/qq_43613689/article/details/112055912)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [浅谈Arrays.asList() 和ArrayList类型区别](https://download.csdn.net/download/weixin_38622849/12791830)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文