Java 数据类型转换

1. Array 转 List

public class Test {
    public static void main(String[] args) {
        List<String> stringA = Arrays.asList("hello", "world", "A");

        String[] stringArray = {"hello", "world", "B"};
        List<String> stringB = Arrays.asList(stringArray);
 
        System.out.println(stringA);
        System.out.println(stringB);
    }
}

 

posted @ 2020-06-23 16:28  湖风雨晚晴  阅读(105)  评论(0编辑  收藏  举报