src/share/classes/java/util/Currency.java

Print this page
rev 4788 : Fix bunch of generics warnings

@@ -97,11 +97,11 @@
     transient private final int numericCode;
 
 
     // class data: instance map
 
-    private static HashMap<String, Currency> instances = new HashMap<String, Currency>(7);
+    private static HashMap<String, Currency> instances = new HashMap<>(7);
     private static HashSet<Currency> available;
 
 
     // Class data: currency data obtained from currency.data file.
     // Purpose:

@@ -187,11 +187,11 @@
 
     // Currency data format version
     private static final int VALID_FORMAT_VERSION = 1;
 
     static {
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 String homeDir = System.getProperty("java.home");
                 try {
                     String dataFile = homeDir + File.separator +
                             "lib" + File.separator + "currency.data";

@@ -398,14 +398,15 @@
      *
      * @return the set of available currencies.  If there is no currency
      *    available in the runtime, the returned set is empty.
      * @since 1.7
      */
+    @SuppressWarnings("unchecked")
     public static Set<Currency> getAvailableCurrencies() {
         synchronized(Currency.class) {
             if (available == null) {
-                available = new HashSet<Currency>(256);
+                available = new HashSet<>(256);
 
                 // Add simple currencies first
                 for (char c1 = 'A'; c1 <= 'Z'; c1 ++) {
                     for (char c2 = 'A'; c2 <= 'Z'; c2 ++) {
                         int tableEntry = getMainTableEntry(c1, c2);