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
- DP
- BFS
- Java
- 개발자 면접 준비
- 프로그래머스 이중우선순위큐 자바
- 이분탐색
- 프로그래머스 이중우선순위큐
- 프로그래머스
- SQL
- ansi sql 장점
- ansi sql 단점
- 그리디
- 백트래킹
- JPA
- CJ DBASE&
- Gradle
- 백준
- oracle ansi
- 위상정렬
- 이중우선순위큐 자바
- 이중우선순위큐 java
- 면접 필수 질문
- DBASE&
- 프로그래머스 이중우선순위큐 java
- 디베이스앤 인턴 후기
- Spring Boot
- DFS
- 디베이스앤
- oracle ansi sql
- 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