Java – Why can’t Java switch over the primitive long?

javalong-integerswitch statement

Possible Duplicate:
Why can’t your switch statement data type be long, Java?

Why is something like that not possible?

private void importantFunction( long arg1 ) {

    switch (arg1){
    case 0:
         // do stuff
        break;
    case 1:
         // do other stuff
        break;
    default:
        //do default stuff
        break;
    }
}

The way I understand long values, there shouldn't be that much of a difference between them and integers.

Best Answer

As per Java 7 you could use a String: LINK TO ORACLE

So basicly this would allow String.valueOf(23423423L);