[TIL] 220527

Moon·2022년 5월 28일

Java

Stream 매핑

result = 0;
List<Integer> listA = Arrays.stream(A)
        .boxed()
        .collect(Collectors.toList());
        
List<Integer> listB = Arrays.stream(B)
        .boxed()
        .collect(Collectors.toList());
        
listA.removeAll(listB);

result = listA.stream().mapToInt(Integer::intValue).sum();
return result;         
            
                                                                          

boxed() : int, long, double 요소를 Integer, Long, Double요소로 박싱해서 Stream을 생성하는 메서드
mapToInt() : 스트림을 IntStream으로 변환해주는 메서드


  • 저번에 과금되는 것 때문에 이것저것 삭제하다가 서브넷도 몇개 삭제했던 것 같은데 그것 때문에 서브넷 그룹 설정하는 부분부터 막혀서 강의를 따라가기 힘들었다. 다시 강의자료 보고 복습하면서 Lambda나 게이트웨이에 관련된 내용을 공부하고 정리해둬야겠다.
profile
매일 성장하는 개발자 되기😊

0개의 댓글