Guide to the yield Keyword in Java

Java’s new yield keyword makes it easier to provide a returned result from switch statements. We look at how it works and how it can help ensure we cover all possible cases.