首页 > 代码库 > Arrays和Collection之间的转换

Arrays和Collection之间的转换

1.将数组转换成固定大小的列表:

public static <T> List<T> asList(T... a)

参数 T... a:数组元素
返回值 List<T>:数组元素的类型的列表

技术分享

 

2.将集合转换成数组

技术分享

 

 

Arrays和Collection之间的转换