Reputation: 91969
What is the preferred way to handle currencies in Java 8
?
The things that could be of interest would be
* Currency Full Name (e.g. United States Dollar)
* Currency Abbreviation (e.g. USD)
* Currency Symbol (e.g. $)
Any other thing that I might be missing here?
What are the best options?
Upvotes: 2
Views: 2116
Reputation: 201447
Java 8 still uses java.util.Currency
and ISO 4217 codes. From the Javadoc,
Represents a currency. Currencies are identified by their ISO 4217 currency codes. Visit the ISO web site for more information, including a table of currency codes.
The class is designed so that there's never more than one
Currency
instance for any given currency. Therefore, there's no public constructor. You obtain aCurrency
instance using thegetInstance
methods.Users can supersede the Java runtime currency data by means of the system property
java.util.currency.data.
Upvotes: 9