Enum : get the keys list
Posted
by Damien MATHIEU
on Stack Overflow
See other posts from Stack Overflow
or by Damien MATHIEU
Published on 2010-04-26T07:59:24Z
Indexed on
2010/04/26
8:03 UTC
Read the original article
Hit count: 198
Hello,
I'm not a java developer. But I'm currently taking a look at Android applications development so I'm doing a bit of nostalgy, doing some java again after not touching it for three years.
I'm looking forward using the "google-api-translate-java" library.
In which there is a Language class. It's an enum allowing to provide the language name and to get it's value for Google Translate.
I can easily get all the values with :
for (Language l : values()) {
// Here I loop on one value
}
But what I'd want to get is a list of all the keys names (FRENCH, ENGLISH, ...).
Is there something like a "keys()" method that'd allow me to loop through all the enum's keys ?
© Stack Overflow or respective owner