SlideShare a Scribd company logo
1 of 54
JAVA 버전은
어떤걸 사용
했는가?
JAVA 17을 사
용했습니다.
JAVA 8에 어
떤 것들이 추
가됐는지 아
는가?
잘 모르겠습
니다!
잘 모르겠습
니다!
자넨
왜 사는가?
1. Lambda Expression
2. Method Reference
3. Collection & Streams
4. Interface Default Method
5. Optional Class
1. Lambda Expression
2. Method Reference
3. Collection & Streams
4. Interface Default Method
5. Optional Class
- 람다 표현식(Lambda Expression)이란 간결하고 함수적인 프로그래밍 스타일을 지원하는 기능.
- 익명의 함수를 만들기 위한 것으로, 함수형 인터페이스를 생성하는 방법
1. 매개변수가 없는 람다 표현식
2. 하나의 매개변수를 갖는 람다 표현식
3. 여러 개의 매개변수를 갖는 람다 표현식
- 메소드 참조(Method Reference)란 람다 표현식이 특정 메소드를 호출하는 경우 간결하게 바꿔줌.
- 즉, 람다 표현식을 더 간결하게 표현 할 수 있음.
1. 정적 메소드 참조
2. 인스턴스 메소드 참조
3. 한정적 인스턴스 메소드 참조
4. 생성자 참조
- 스트림(Stream)이란 연속된 처리 작업을 선언적으로 표현한데 사용하는 것.
- 즉, 연속된 처리 작업을 효율적으로 하게 해줌.
- 스트림(Stream)이란 연속된 처리 작업을 선언적으로 표현한데 사용하는 것.
- 즉, 연속된 처리 작업을 효율적으로 하게 해줌.
1. 데이터 소스
2. 중간 연산자
3. 최종 연산자
데이터 소스
중간 연산자
최종 연산자
1. Static 메소드를 사용하여 생성
2. Collection.stream()을 사용하여 생성
준커의 블로그
중간 연산자는 Stream 타입의 데이터 소스를 조건에 맞게 가공하여 가
공된 Stream을 반환하는 연산자
1. filter()
2. map()
3. flatMap()
4. limit()
5. peek
6. skip()
7. sorted()
1. filter()
2. map()
3. flatMap()
4. limit()
5. peek
6. skip()
7. sorted()
- Stream 요소 중 조건에 맞는 요소들만 선택하는 기능.
- if문과 비슷한 역할
- Stream 요소를 다른 형태로 변환하는 기능
준커의 블로그
최종 연산자는 Stream을 특정 Collection으로 변환하거나, 결과
를 나타냄.
1. allMatch()
2. anyMatch()
3. noneMatch()
4. collect()
5. Count()
6. findAny()
7. findFirst()
8. forEach()
9. forEachOrdered()
10. max()
11. min()
12. educe()
13. toArray()
1. allMatch()
2. anyMatch()
3. noneMatch()
4. collect()
5. Count()
6. findAny()
7. findFirst()
8. forEach()
9. forEachOrdered()
10. max()
11. min()
12. educe()
13. toArray()
- 말 그대로 반복문
- Stream 요소를 Collection으로 변환해줌.
- Stream 요소를 Collection으로 변환해줌.
- .collect(Collectors.toList())와 같은 역할.
- Stream 요소를 Collection으로 변환해줌.
- .collect(Collectors.toList())와 같은 역할.
- Stream 요소를 Collection으로 변환해줌.
- .collect(Collectors.toList())와 같은 역할.
*주의 사항*
- Stream 요소를 Collection으로 변환해줌.
- .collect(Collectors.toList())와 같은 역할.
*주의 사항*
(1)
.toList()는 JAVA16에 추가됨.
-> 따라서 JAVA 16버전 이하에선 사용불가능
(2)
.collect(Collectors.toList()) vs .toList()
-> 가장 큰 차이는 생성된 List의 가변, 불변의 차이
-> .collect(Collectors.toList()): 가변 List를 리턴
-> .toList(): 불변 List를 리턴
- Stream 요소를 Collection으로 변환해줌.
- .collect(Collectors.toList())와 같은 역할.
- Stream 요소를 Collection으로 변환해줌.
- .collect(Collectors.toList())와 같은 역할.
준커의 블로그
- JAVA의 영원한 숙적인 NullPointerException을 방지해주는 GOD
- 즉, null인 값을 참조해도 NullPointerException이 발생하지 않도
록 값을 래퍼로 감싸주는 타입입니다.
- 흔하게 볼 수 있는 곳은 Spring Data JPA를 사용할 때 Repository에
서 findById()의 반환값은 Optional 타입입니다.
1. empty() -> 비어 있는 Optional 생성
-> 값이 있는 Optional 생성
-> 값이 있을 수도 있고, 없을
수도 있는 Optional 생성
2. of()
3. ofNullable()
1. empty() -> 비어 있는 Optional 생성
-> 값이 있는 Optional 생성
-> 값이 있을 수도 있고, 없을
수도 있는 Optional 생성
2. of()
3. ofNullable()
1. equals()
2. filter()
3. map()
4. flatMap()
5. get()
6. isEmpty()
7. isPresent()
8. ifPresent()
9. ifPresentOrElse()
10. or()
11. orElse()
12. orElseGet()
13. orElseThrow()
14. stream()
15. toString()
16. hashCode()
1. equals()
2. filter()
3. map()
4. flatMap()
5. get()
6. isEmpty()
7. isPresent()
8. ifPresent()
9. ifPresentOrElse()
10. or()
11. orElse()
12. orElseGet()
13. orElseThrow()
14. stream()
15. toString()
16. hashCode()
- if else의 역할. Optional이 null일 때와 null이 아닐 때의 연산을 지정
후 수행
- Optional이 비어 있는 경우 다른 타입의 객체를 반환
[.or()은 또 다른 Optional 객체를 반환]
- Optional이 비어 있는 경우 Exception을 반환
1. 파라미터가 없는 경우
2. 파라미터가 있는 경우
2. 파라미터가 있는 경우 + 메소드 참조
준커의 블로그

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

조리돌림 JAVA8 기반의 기능.pptx

  • 1.
  • 2.
  • 4. JAVA 8에 어 떤 것들이 추 가됐는지 아 는가? 잘 모르겠습 니다!
  • 6.
  • 7. 1. Lambda Expression 2. Method Reference 3. Collection & Streams 4. Interface Default Method 5. Optional Class 1. Lambda Expression 2. Method Reference 3. Collection & Streams 4. Interface Default Method 5. Optional Class
  • 8. - 람다 표현식(Lambda Expression)이란 간결하고 함수적인 프로그래밍 스타일을 지원하는 기능. - 익명의 함수를 만들기 위한 것으로, 함수형 인터페이스를 생성하는 방법
  • 9. 1. 매개변수가 없는 람다 표현식 2. 하나의 매개변수를 갖는 람다 표현식 3. 여러 개의 매개변수를 갖는 람다 표현식
  • 10.
  • 11.
  • 12.
  • 13. - 메소드 참조(Method Reference)란 람다 표현식이 특정 메소드를 호출하는 경우 간결하게 바꿔줌. - 즉, 람다 표현식을 더 간결하게 표현 할 수 있음.
  • 14. 1. 정적 메소드 참조 2. 인스턴스 메소드 참조 3. 한정적 인스턴스 메소드 참조 4. 생성자 참조
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. - 스트림(Stream)이란 연속된 처리 작업을 선언적으로 표현한데 사용하는 것. - 즉, 연속된 처리 작업을 효율적으로 하게 해줌.
  • 24. - 스트림(Stream)이란 연속된 처리 작업을 선언적으로 표현한데 사용하는 것. - 즉, 연속된 처리 작업을 효율적으로 하게 해줌.
  • 25. 1. 데이터 소스 2. 중간 연산자 3. 최종 연산자
  • 27. 1. Static 메소드를 사용하여 생성 2. Collection.stream()을 사용하여 생성
  • 29. 중간 연산자는 Stream 타입의 데이터 소스를 조건에 맞게 가공하여 가 공된 Stream을 반환하는 연산자 1. filter() 2. map() 3. flatMap() 4. limit() 5. peek 6. skip() 7. sorted() 1. filter() 2. map() 3. flatMap() 4. limit() 5. peek 6. skip() 7. sorted()
  • 30. - Stream 요소 중 조건에 맞는 요소들만 선택하는 기능. - if문과 비슷한 역할
  • 31. - Stream 요소를 다른 형태로 변환하는 기능
  • 33. 최종 연산자는 Stream을 특정 Collection으로 변환하거나, 결과 를 나타냄. 1. allMatch() 2. anyMatch() 3. noneMatch() 4. collect() 5. Count() 6. findAny() 7. findFirst() 8. forEach() 9. forEachOrdered() 10. max() 11. min() 12. educe() 13. toArray() 1. allMatch() 2. anyMatch() 3. noneMatch() 4. collect() 5. Count() 6. findAny() 7. findFirst() 8. forEach() 9. forEachOrdered() 10. max() 11. min() 12. educe() 13. toArray()
  • 34. - 말 그대로 반복문
  • 35. - Stream 요소를 Collection으로 변환해줌.
  • 36. - Stream 요소를 Collection으로 변환해줌. - .collect(Collectors.toList())와 같은 역할.
  • 37. - Stream 요소를 Collection으로 변환해줌. - .collect(Collectors.toList())와 같은 역할.
  • 38. - Stream 요소를 Collection으로 변환해줌. - .collect(Collectors.toList())와 같은 역할. *주의 사항*
  • 39. - Stream 요소를 Collection으로 변환해줌. - .collect(Collectors.toList())와 같은 역할. *주의 사항* (1) .toList()는 JAVA16에 추가됨. -> 따라서 JAVA 16버전 이하에선 사용불가능 (2) .collect(Collectors.toList()) vs .toList() -> 가장 큰 차이는 생성된 List의 가변, 불변의 차이 -> .collect(Collectors.toList()): 가변 List를 리턴 -> .toList(): 불변 List를 리턴
  • 40. - Stream 요소를 Collection으로 변환해줌. - .collect(Collectors.toList())와 같은 역할.
  • 41. - Stream 요소를 Collection으로 변환해줌. - .collect(Collectors.toList())와 같은 역할.
  • 43. - JAVA의 영원한 숙적인 NullPointerException을 방지해주는 GOD - 즉, null인 값을 참조해도 NullPointerException이 발생하지 않도 록 값을 래퍼로 감싸주는 타입입니다. - 흔하게 볼 수 있는 곳은 Spring Data JPA를 사용할 때 Repository에 서 findById()의 반환값은 Optional 타입입니다.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48. 1. empty() -> 비어 있는 Optional 생성 -> 값이 있는 Optional 생성 -> 값이 있을 수도 있고, 없을 수도 있는 Optional 생성 2. of() 3. ofNullable()
  • 49. 1. empty() -> 비어 있는 Optional 생성 -> 값이 있는 Optional 생성 -> 값이 있을 수도 있고, 없을 수도 있는 Optional 생성 2. of() 3. ofNullable()
  • 50. 1. equals() 2. filter() 3. map() 4. flatMap() 5. get() 6. isEmpty() 7. isPresent() 8. ifPresent() 9. ifPresentOrElse() 10. or() 11. orElse() 12. orElseGet() 13. orElseThrow() 14. stream() 15. toString() 16. hashCode() 1. equals() 2. filter() 3. map() 4. flatMap() 5. get() 6. isEmpty() 7. isPresent() 8. ifPresent() 9. ifPresentOrElse() 10. or() 11. orElse() 12. orElseGet() 13. orElseThrow() 14. stream() 15. toString() 16. hashCode()
  • 51. - if else의 역할. Optional이 null일 때와 null이 아닐 때의 연산을 지정 후 수행
  • 52. - Optional이 비어 있는 경우 다른 타입의 객체를 반환 [.or()은 또 다른 Optional 객체를 반환]
  • 53. - Optional이 비어 있는 경우 Exception을 반환 1. 파라미터가 없는 경우 2. 파라미터가 있는 경우 2. 파라미터가 있는 경우 + 메소드 참조