기본형특화스트림 (1) 썸네일형 리스트형 Java Stream & Reduce VS mapToInt Performance 비교 List numList = new ArrayList(); for(int i=0; i i).reduce(0, Integer::sum); long end1 = System.currentTimeMillis(); long start2= System.currentTimeMillis(); numList.stream().mapToInt(i -> i).sum(); long end2 = System.currentTimeMillis(); System.out.println("first : " + (end1 - start1)); System.out.println("second : " + (end2 - start2)); 결과first : 1489second : 40 이렇게 많은 시간이 차이나는 이유는 reduce 연산중 내부에.. 이전 1 다음