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 | 31 |
Tags
- DFS
- Spring Boot
- 디베이스앤
- ansi sql 장점
- 면접 필수 질문
- 이중우선순위큐 java
- 프로그래머스 이중우선순위큐
- DP
- CJ DBASE&
- 백준
- Java
- 위상정렬
- JPA
- oracle ansi sql
- 그리디
- 디베이스앤 인턴 후기
- 이중우선순위큐 자바
- BFS
- Gradle
- ansi sql 단점
- 이분탐색
- 프로그래머스
- DBASE&
- oracle ansi
- 백트래킹
- SQL
- 개발자 면접 준비
- 프로그래머스 이중우선순위큐 자바
- 프로그래머스 이중우선순위큐 java
- IT 면접 준비
Archives
- Today
- Total
목록Optional (1)
쉬운 프로그래밍
Optional을 통한 예외처리
public Long join(Member member) { //중복 예외처리 Optional result = memberRepository.findById(member.getId()); result.ifPresent(m -> { throw new IllegalStateException("이미 존재하는 회원입니다."); }); } 위와 같이 Optional을 바로 return받아서 예외처리를 할 수 있지만 이는 좋은 방법이 아니다. public Long join(Member member) { // Optional 더 깔끔하게 this.memberRepository.findById(member.getId()) .ifPresent(m -> { throw new IllegalStateException("이미 ..
Programming/Java
2021. 1. 21. 12:57