Java 7: Strings in Switch
Dolphin extends the switch operator to String
Let’s consider an example: you have a String that may have three values: “foo”, “bar” and “me”.
With current Java versions, to emulate the switch you have to create an Java 5 enum, or to write multiple if / then / else.
Dolphin will introduce a switch operator, which will allow you to write
switch(myVar){ case "foo": // handle "foo" break; case "bar": // handle "bar" case "me" // handle "me" default: // handle default }