switch for Object

Neal Gafter neal at gafter.com
Mon May 30 09:44:14 PDT 2011


On Sun, May 29, 2011 at 1:41 AM, a d <cld71 at hotmail.com> wrote:

>  Recently I have been looking at proposed Java language changes in Java
> 7.0.
> One of the areas that is being changed that I can't stop thinking about is
> the switch for String, and was wondering why just for String?
> Why not add a switch for all Objects that implement java.lang.Comparable<T>
> or java.util.Comparator<T> to make easier to use the switch operator?
>

The frist reason that comes to mind is that String is the only object type
that can be a compile-time constant.



More information about the coin-dev mailing list