Enum.getConstants() Was: Automatic Resource Management, V.2

Stephen Colebourne scolebourne at joda.org
Mon Apr 20 11:39:12 PDT 2009

2009/4/20 Rémi Forax <forax at univ-mlv.fr>:
> Stephen Colebourne a écrit :
>> For example, I would have much preferred Enums to have had a Map of
>> name to enum as a generated method. I currently have to have a code
>> generator create this for every enum I write.
> Hi Stephen,
> Are you aware of Class.getEnumConstants() ?
> I think that using this method you can write only one generic code for all
> enums.
> Moreover, this map already exists in the class java.lang.Class, if you want
> to expose it, you can vote for that RFE
> http://bugs.sun.com/view_bug.do?bug_id=5034509

Yes, I'm aware of that method. Like all APIs, its working out what
might be needed in advance, and I happen to think that the collections
API is much more flexible than arrays.

More information about the coin-dev mailing list