I am interested in Initializing EnumMap with all possible fields of
enume
enum Size{
BIG, SMALL:
}
EnumMap<Size, Integer> sizeMap =new EnumMap(Size.class);
for i in Size
EnumMap.put(i, 0)
Thanks
Thomas Fritsch - 23 Jun 2006 08:15 GMT
> I am interested in Initializing EnumMap with all possible fields of
> enume
[quoted text clipped - 8 lines]
> for i in Size
> EnumMap.put(i, 0)
Your Size class has a method
public static final Size[] values();
implicitly generated by the compiler.
(You can do a javap to convince yourself about that.)
Call Size.values() and iterate over the returned array.

Signature
Thomas