반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- SQL
- AWS CI/CD 구축하기
- chart.js
- aws
- java bigdecimal
- node
- JavaScript
- Flux
- Jenkins
- IntelliJ
- COALESCE
- codebuild
- Airflow
- or some instances in your deployment group are experiencing problems.
- Spring
- kubeflow
- codedeploy error
- Python
- bootstrap
- VPN
- codedeploy
- docker
- aws cicd
- Kafka
- Spring Error
- PostgreSQL
- codepipeline
- chartjs
- redis
- 도커
Archives
- Today
- Total
Small Asteroid Blog
[java] java stream 으로 합계(sum) 구하기 본문
728x90
Integer memberId = 1;
TotalDto dto = TotalDto.builder()
.contribution1(contributionDto.stream().mapToLong(ContributionDto::getTotalAmount).sum())
.contribution2(contributionDto.stream().filter(x -> x.getId().equals(memberId)).mapToLong(ContributionDto::getTotalAmount).sum())
.build();
728x90
반응형
'백엔드 > Java' 카테고리의 다른 글
[Java] 자바에서 날짜 데이터 형식 변경 (년/월 가져오기, 분기 계산하기, 날짜 포맷 변경) (0) | 2023.03.14 |
---|---|
[Java] 자바 실행 시간 측정 (0) | 2023.01.17 |
[java] java stream filter and return string (0) | 2023.01.12 |
[Java] 월의 말일 구하기 (0) | 2022.12.20 |
[Java] 월별 분기 구하기 (0) | 2022.12.20 |