数组转list的小知识
来源:互联网 发布:只有我知3小时14分超清 编辑:程序博客网 时间:2024/06/05 13:59
String phone = "a,b,c,d";
Arrays.asList(phone.split(","));
这个产生的是一个固定大小,不可变的数组,
是无法进行增加,删除操作的,作用有限 ,jdk里面解释为:
@SafeVarargs
Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array.) This method acts as bridge between array-based and collection-based APIs, in combination with Collection.toArray
. The returned list is serializable and implements RandomAccess
.
This method also provides a convenient way to create a fixed-size list initialized to contain several elements:
List<String> stooges = Arrays.asList("Larry", "Moe", "Curly");
- Parameters:
- a the array by which the list will be backed
- Returns:
- a list view of the specified array //只是作为一种view形式
Lists.newArrayList(phone.split(","));
@GwtCompatible(serializable=true)
Creates a mutableArrayList
instance containing the given elements.
Note: if mutability is not required and the elements are non-null, use an overload of ImmutableList.of()
(for varargs) or ImmutableList.copyOf(Object[])
(for an array) instead.
- Parameters:
- elements the elements that the list should contain, in order
- Returns:
- a new
ArrayList
containing those elements
0 0
- 数组转list的小知识
- List的小知识
- list跟数组相互转换的小知识
- 数组和指针的一些小知识
- 数组与指针的小知识
- String数组转List,List转String数组---小笔记
- javascript数组小知识
- 小知识数组超出边界
- java之数组小知识
- android小知识:ArrayList和数组之间的转换
- 【C语言】——二维数组的小知识
- android小知识:ArrayList和数组之间的转换
- android小知识:ArrayList和数组之间的转换
- string和char数组的一些小知识
- java中关于数组知识的小总结
- android小知识:ArrayList和数组之间的转换
- 把int数组转换成list的小方法
- android小技巧:list、set、数组的相互转换
- 文件夹压缩成.zip格式
- RTSP协议介绍
- PHP扩展开发-zval结构体
- VPN篇(5.2)-02. IPSec VPN (FortiClient 客户端) ❀ 飞塔 (Fortinet) 防火墙
- 字符流和字节流的区别,使用场景,相关类
- 数组转list的小知识
- Windows系统中如何配置Apache的SSL加密访问
- 软件测试中的V模型、W模型和H模型
- 简易版的随机地图方法,适合少数场景
- RelativeLayout重要属性
- 定义变量的位置 @interface VS @implementation
- 为listview,gridview添加布局动画效果(通过资源文件方式)
- STL之容器、迭代器及算法知识总结
- 合并两个已排序的链表