I would like to get all possible available currencies.
Java 7 had provided such feature.
public static Set java.util.Currency.g
After studying the ISO table and the Currency class documentation, it seems that you can ask for currency as code or as Locale; and the class Locale has a getAvailableLocales() method.
So, the code would be:
public static Set getAllCurrencies()
{
Set toret = new HashSet();
Locale[] locs = Locale.getAvailableLocales();
for(Locale loc : locs) {
try {
Currency currency = Currency.getInstance( loc );
if ( currency != null ) {
toret.add( currency );
}
} catch(Exception exc)
{
// Locale not found
}
}
return toret;
}
Hope this helps.