Posts

Showing posts with the label Java 13 features

Java 13 Features

This post is the introduction of commonly used Java 13 features.  Switch expressions: This is still in Preview stage in Java 13 version. The main difference about switch expressions in Java 12 and Java 13 is the introduction of Yeild in Java 13.  Yeild is used to differentiate between Switch statements (Java 11 or less) and Switch expressions (Java 12 or more).  Primarily the new Switch expressions eliminates the need of break statement and also multiple case statements.  Eliminating the break statement reduces lot of verbosity and no need for developers to remember it whenever they use switch. Accidentally if developers forget about adding break statement, it introduces bugs and deviate application to meet business requirements. So using Switch expressions improves efficiency of the code and increases productivity.  Earlier multiple case statements introduced lot of boilerplate code. But with introduction of Switch expressions, we can simply group the related things under one case sta