I am not a Java developer. But I'm looking at Android app development right now, so I'm doing a bit of nostalgia, doing a few java again without touching it for three years.
I look forward to using google-api-translate-java library.Which has a Language class . This listing allows you to provide the name of the language and get its meaning for Google Translate.
I can easily get all the values ββwith:
for (Language l : values()) { // Here I loop on one value }
But I would like to get a list of all the key names (FRENCH, ENGLISH, ...).Is there something like the "keys ()" method that would allow me to iterate over all the enumeration keys?
Language.values() EnumSet:
Language.values()
EnumSet
for (Language l : EnumSet.allOf(Language.class)) { }
, API, . ( , ... , , . .)
values(), , - , , EnumSet.
values()
: , , toString() - name() :
toString()
name()
for (Language l : Language.values()) { String name = l.name(); // Do stuff here }
:
for (Language l : Language.values()) { l.name(); }
. :
. X, X.values ββ(). . .
Source: https://habr.com/ru/post/1742768/More articles:JQuery Datepicker does not select default date - jqueryCustom HTML output on Zend Form Checkbox setLabel Property - htmlDjango registration and ReCaptcha integration - how to pass user IP address - pythonProblem with C ++ recursion - c ++How can I get the file size in Perl before processing the download request? - uploadHow to enable indexing of pages with dynamic data? - architectureSharepoint: how to get the current site / web list - sharepointdecoding algorithm - algorithmUpdating the application icon in the Windows 7 taskbar - windows-7How to detect identical part (s) inside a string? - pythonAll Articles