Strings in Switch .. and classes

Tom Hawtin Thomas.Hawtin at Sun.COM
Wed Dec 16 10:37:05 PST 2009


Paul Benedict wrote:

> Class c = o.getClass();
> if (c instanceof String) {  .. }

> Can be de-sugared into the new String switch:
> 
> switch (object.getClass().getName()) {
>   case "java.lang.String":

Class names are not unique.

Tom Hawtin



More information about the coin-dev mailing list