Dealing with completeness (type coverage) in pattern labels for switch 2 – Objects, Immutability, Switch Expressions, and Pattern Matching

Now, the selector expression can be any type which means that the total pattern Vehicle v is not total anymore. While Vehicle v becomes an optional ordinary pattern, the new total pattern is case Object obj. This means that we can cover all possible values by adding the default label or the case Object obj […]

© 2024 nickshade Please read our Terms and Privacy Policy. We also use Cookies.