Java

Java int[] ๋ฐฐ์—ด List<Integer>๋กœ ๋ณ€ํ™˜

๋…ธ๋ฃจ๋ฃฝ 2021. 6. 7. 17:52

Java int[] ๋ฐฐ์—ด List<Integer>๋กœ ๋ณ€ํ™˜

    public static void main(String[] args) {
        int[] arr = {93, 30, 55};
        List<Integer> list = Arrays.stream(arr).boxed().collect(Collectors.toList());

        System.out.println(Arrays.toString(arr));
        System.out.println(list);
    }

 

๊ฒฐ๊ณผ

Java 8 ์ด์ƒ์—์„œ๋งŒ ๋œ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.