I would like to get all possible available currencies.
Java 7 had provided such feature.
public static Set java.util.Currency.g
I have been using Baltasarq's answer and I find it slows down my app due to a number of java.lang.IllegalArgumentException's being thrown, which is no fault of his, but actually the author of the Currency library, who has elected to throw an exception as opposed to an error (Raw Code).
However looking into that Library, there is a public static method getAvailableCurrencies
which will give you all the available currencies as a set without having to loop through all the available locales and throw a bunch of exceptions.
The revised code now looks like this:
public static Set getAllCurrencies() {
Set currencies = Currency.getAvailableCurrencies();
return currencies;
}
Which of course, is silly, you can just as well use the Currency's own static method and save yourself an unnecessary method call. #SaveTheStack