2021. 3. 29. 12:59ㆍData science
1) Exam Overview
2) Prepare for an Exam
3) How to approach Questions
해설)
1) Firstly, we are creating a list of strings. And we have a return statement. (List to Stream converting-> this does NOT mean that this the result will return a stream)
2) In the return statement, we filter.(Still stream, but it's empty as we don't have Bart in the list)
3) We call findAny. (Any objects in the resulting stream - returns an optional)
4) 'Optional object' = a wrapper (instead of return a null value, gives you an optional as a layer of safety)
-> SO A is WRONG, B is CORRECT
5) the collection made out of List.of in Java is immutable. NOT allowed to add elements of the collection.
-> SO C is WRONG
6) .get takes optional and returns whatever value it contains. But in this case, there is no Bart in the Collection. -> This means it's an exception.In the questions, it says "Complies exception-free code"
-> D is WRONG
7) .orElse takes optional and returns whatever value it contains. In this case, rather than presenting 'no value'(Exception), throwing an alternative value("Not Found").
-> E is CORRECT
'Data science' 카테고리의 다른 글
[Oracle_Java] Java SE: Programming Complete_01 (0) | 2021.03.30 |
---|---|
[ORC_Java Prep] 2. Local Variable Type Inference Local Variable Syntax for Lambda Parameters (0) | 2021.03.29 |
[빅분기] 1과목 1장 2 빅데이터 가치 (0) | 2021.03.28 |
[빅분기] 1과목 1장 1 빅데이터의 특징 (0) | 2021.03.28 |
[빅분기] 빅데이터 분석 기사 개요 (0) | 2021.03.26 |