File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
src/com/blankj/study/temp Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .blankj .study .temp ;
2
+
3
+ import java .util .Arrays ;
4
+ import java .util .List ;
5
+ import java .util .stream .Collectors ;
6
+
7
+
8
+ public class Test13 {
9
+ public static void main (String [] args ) {
10
+ int [] arr = {1 , 2 , 3 };
11
+ List list = Arrays .asList (arr );
12
+ //System.out.println(list);
13
+ //正确方式
14
+ List arrlist = Arrays .stream (arr ).boxed ().collect (Collectors .toList ());
15
+ System .out .println (arrlist );
16
+
17
+
18
+ String [] a = {"我" , "是" , "龙" };
19
+ List list1 = Arrays .asList (a );
20
+ System .out .println (list1 );
21
+ a [1 ] = "不是" ;
22
+ list1 .set (2 , "虫" );
23
+ System .out .println (Arrays .toString (a ));
24
+ System .out .println (list1 .toString ());
25
+
26
+ //list1.add("新增");
27
+ //list1.remove("我");
28
+ System .out .println (list1 );
29
+
30
+
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments