I have an enum switch more or less like this:
public static enum MyEnum {A, B}
public int foo(MyEnum value) {
switch(value) {
case(A):
I would put the default case with one of enum cases:
public static enum MyEnum {A, B}
public int foo(MyEnum value) {
if (value == null) throw new IllegalArgumentException("Do not know how to handle " + value);
switch(value) {
case(A):
return calculateSomething();
case(B):
default:
return calculateSomethingElse();
}
}