Stream

hg0710·2023년 2월 28일
0

        String str = numbers
                .stream()//스트림 만들기
                .sorted()//오름차순으로 배열
                .map(e -> "" + e)//integer을 string으로 변환
                .collect(Collectors.joining(", "));// , 을 기준으로 나열
                
 devices =devices
                    //이거는 devices =devices.stream().sorted().collect() 이거임
                    // 복사본을 만들고 정렬하고 콜렉트해서 넣는거임

                    .stream()
                    .sorted((e1, e2) -> e1.getId() - e2.getId())
                    .collect(Collectors.toList());
                    

0개의 댓글