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,14 @@
|
||||
/** Must NOT compile: the switch forgets Cod, and Payment is sealed, so the compiler knows. */
|
||||
public class NonExhaustiveSwitch {
|
||||
sealed interface Payment permits Card, Upi, Cod {}
|
||||
record Card(String last4) implements Payment {}
|
||||
record Upi(String vpa) implements Payment {}
|
||||
record Cod() implements Payment {}
|
||||
|
||||
static String describe(Payment p) {
|
||||
return switch (p) {
|
||||
case Card c -> "card " + c.last4();
|
||||
case Upi u -> "UPI " + u.vpa();
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user