[kcdc 2025] The Amazing Features of Modern Java

Speaker: Venkat Subramaniam

For more see the table of contents


Switch

  • Showed switch with break missing
  • Turned it into a switch expression by changing the code in place.
  • Emphasized code more concise and not writing extra break
  • Can match multiple values
  • Can add {} and multiple lines of code with yield. Not recommended. [so glad he said not recommended}.
  • If use return instead of yield, compiler tells you what is wrong “attempt to return out of a switch expression” instead of what to do. [fun analogy about inlaws telling you what is wrong]

[i had more notes than this – record and sealed classes – i messed up saving]

My take

I missed some of this because I was getting ready for my session immediately after this. I’ve seen Venkat speak many times and am familiar with the content. I came mainly because Venkat is an amazing speaker and has great energy.

Leave a Reply

Your email address will not be published. Required fields are marked *