Add experienced-2-3y module: 31 scenario questions (core Java, collections/streams, concurrency, Spring Boot 4.2, JPA N+1, REST problem details, SQL) with 7 asserting tests and 8 transcripts
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6u469kis46DspusiL
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
4180e746ef
commit
76012dd8c3
@@ -0,0 +1,21 @@
|
||||
== Q7: TreeSet and a comparator that says 'equal' ==
|
||||
TreeSet by length only: [fig, apple] (3 words added, size 2)
|
||||
length then natural: [fig, apple, grape]
|
||||
== Q8: List<Integer>.remove(int) vs remove(Object) ==
|
||||
remove(1) -> [10, 30]
|
||||
remove(Integer.valueOf(10)) -> [20, 30]
|
||||
== Q9: Collectors.toMap with a duplicate key ==
|
||||
toMap(city, amount) -> IllegalStateException: Duplicate key Pune (attempted merging values 100 and 250)
|
||||
toMap with Integer::sum -> {Mumbai=300, Pune=350}
|
||||
groupingBy + counting -> {Mumbai=1, Pune=2}
|
||||
== Q10: streams are lazy ==
|
||||
no terminal operation: elements touched = 0
|
||||
findFirst() on evens: result = 2, elements touched = 2
|
||||
== Q11: Optional.orElse vs orElseGet ==
|
||||
orElse(expensiveDefault()) -> default computed 1 time(s)
|
||||
orElseGet(expensiveDefault) -> default computed 0 time(s)
|
||||
== Q12: comparator chain with nulls ==
|
||||
Employee[name=Kiran, dept=Eng, salary=80000]
|
||||
Employee[name=Meera, dept=Sales, salary=120000]
|
||||
Employee[name=Asha, dept=Sales, salary=90000]
|
||||
Employee[name=Ravi, dept=null, salary=70000]
|
||||
Reference in New Issue
Block a user