Modern Java from Microsoft JDConf

Speaker: Venkat Subramaniam – @venkat_s

I was curious to see Venkat speak for only 25 minutes! It’s like he can speak to expand/shrink to available time. (Note: I added the version numbers since these features aren’t on the latest LTS). It was a normal “Textmate” live talk

  • Reduce ceremony
  • Java 14 – Pattern matching with instanceof. – Can use variable inside of instance of as if it were cast
  • Java 14 – Switch expression – automatic breaks, multiple matches, multiline cases, return values. Leading us to pattern matching in future
  • Java 14 – Multiline text blocks – don’t need to escape, multi line strings, smart indentation. Can use \s if want to preserve whitespace at beginning of next line
  • Java 16 – Records – data classes. Automatic getter (field name not getX), implicit equals() method based on all fields. Can still write constructor manually if want validation, immutable, can use as a Tuple. Even locally within a lass if that’s the scope you need. In future, pattern matching
  • Future: Sealed classes (preview feature in Java 15). Use “permits” to list what classes are allowed to extend