src/share/classes/java/util/WeakHashMap.java

Print this page
rev 3186 : 6880112: Project Coin: Port JDK core library code to use diamond operator

@@ -169,11 +169,11 @@
     private final float loadFactor;
 
     /**
      * Reference queue for cleared WeakEntries
      */
-    private final ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
+    private final ReferenceQueue<Object> queue = new ReferenceQueue<>();
 
     /**
      * The number of times this WeakHashMap has been structurally modified.
      * Structural modifications are those that change the number of
      * mappings in the map or otherwise modify its internal structure

@@ -437,11 +437,11 @@
             }
         }
 
         modCount++;
         Entry<K,V> e = tab[i];
-        tab[i] = new Entry<K,V>(k, value, queue, h, e);
+        tab[i] = new Entry<>(k, value, queue, h, e);
         if (++size >= threshold)
             resize(tab.length * 2);
         return null;
     }
 

@@ -954,13 +954,13 @@
             WeakHashMap.this.clear();
         }
 
         private List<Map.Entry<K,V>> deepCopy() {
             List<Map.Entry<K,V>> list =
-                new ArrayList<Map.Entry<K,V>>(size());
+                new ArrayList<>(size());
             for (Map.Entry<K,V> e : this)
-                list.add(new AbstractMap.SimpleEntry<K,V>(e));
+                list.add(new AbstractMap.SimpleEntry<>(e));
             return list;
         }
 
         public Object[] toArray() {
             return deepCopy().toArray();