Enum.valueOf(String)
Omair Majid
omajid at redhat.com
Tue Aug 20 20:38:31 UTC 2013
On 08/20/2013 04:09 PM, Eamonn McManus wrote:
> It might occur to me to look at valueOf(Class, String) if I was
> looking for a method to convert a string to an enum constant, but I
> don't think it would occur to me to look there if I was looking for a
> method to get all the values of an enum. I'm sure plenty of people end
> up using MyEnum.class.getEnumConstants() because that *is* linked to
> from the class javadoc.
As a counter-argument, using an IDE's auto-complete makes it really
really easy to discover the values() method.
In fact, it never even occurred to me that there is an
MyEnum.class.getEnumConstants() method that would do the same.
Cheers,
Omair
More information about the core-libs-dev
mailing list