添加链接描述
package com.mindskip.xzs.utility;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ListUtil {
public static <T> List<T> arrToArrayList(T... a) {
List<T> lst =new ArrayList<>(Arrays.asList(a));
return lst;
}
public static void main(String[] args) {
String[] strings= new String[] { "zs", "ls", "ww" };
List<String> list = ListUtil.arrToArrayList(strings);
System.out.println("list");
System.out.println(list);
list.add("ddd");
System.out.println("list");
System.out.println(list);
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41