< prev index next >

src/java.base/share/classes/java/util/Hashtable.java

Print this page

        

@@ -308,11 +308,11 @@
     public synchronized boolean contains(Object value) {
         if (value == null) {
             throw new NullPointerException();
         }
 
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         for (int i = tab.length ; i-- > 0 ;) {
             for (Entry<?,?> e = tab[i] ; e != null ; e = e.next) {
                 if (e.value.equals(value)) {
                     return true;
                 }

@@ -346,11 +346,11 @@
      *          {@code equals} method; {@code false} otherwise.
      * @throws  NullPointerException  if the key is {@code null}
      * @see     #contains(Object)
      */
     public synchronized boolean containsKey(Object key) {
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         for (Entry<?,?> e = tab[index] ; e != null ; e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
                 return true;

@@ -374,11 +374,11 @@
      * @throws NullPointerException if the specified key is null
      * @see     #put(Object, Object)
      */
     @SuppressWarnings("unchecked")
     public synchronized V get(Object key) {
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         for (Entry<?,?> e = tab[index] ; e != null ; e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
                 return (V)e.value;

@@ -432,11 +432,11 @@
             }
         }
     }
 
     private void addEntry(int hash, K key, V value, int index) {
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         if (count >= threshold) {
             // Rehash the table if the threshold is exceeded
             rehash();
 
             tab = table;

@@ -474,11 +474,11 @@
         if (value == null) {
             throw new NullPointerException();
         }
 
         // Makes sure the key is not already in the hashtable.
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> entry = (Entry<K,V>)tab[index];
         for(; entry != null ; entry = entry.next) {

@@ -501,11 +501,11 @@
      * @return  the value to which the key had been mapped in this hashtable,
      *          or {@code null} if the key did not have a mapping
      * @throws  NullPointerException  if the key is {@code null}
      */
     public synchronized V remove(Object key) {
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for(Entry<K,V> prev = null ; e != null ; prev = e, e = e.next) {

@@ -541,11 +541,11 @@
 
     /**
      * Clears this hashtable so that it contains no keys.
      */
     public synchronized void clear() {
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         for (int index = tab.length; --index >= 0; )
             tab[index] = null;
         modCount++;
         count = 0;
     }

@@ -928,11 +928,11 @@
     @Override
     public synchronized V putIfAbsent(K key, V value) {
         Objects.requireNonNull(value);
 
         // Makes sure the key is not already in the hashtable.
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> entry = (Entry<K,V>)tab[index];
         for (; entry != null; entry = entry.next) {

@@ -951,11 +951,11 @@
 
     @Override
     public synchronized boolean remove(Object key, Object value) {
         Objects.requireNonNull(value);
 
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {

@@ -976,11 +976,11 @@
 
     @Override
     public synchronized boolean replace(K key, V oldValue, V newValue) {
         Objects.requireNonNull(oldValue);
         Objects.requireNonNull(newValue);
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (; e != null; e = e.next) {

@@ -997,11 +997,11 @@
     }
 
     @Override
     public synchronized V replace(K key, V value) {
         Objects.requireNonNull(value);
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (; e != null; e = e.next) {

@@ -1026,11 +1026,11 @@
      */
     @Override
     public synchronized V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
         Objects.requireNonNull(mappingFunction);
 
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (; e != null; e = e.next) {

@@ -1062,11 +1062,11 @@
      */
     @Override
     public synchronized V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
 
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {

@@ -1104,11 +1104,11 @@
      */
     @Override
     public synchronized V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
 
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {

@@ -1155,11 +1155,11 @@
      */
     @Override
     public synchronized V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
 
-        Entry<?,?> tab[] = table;
+        Entry<?,?>[] tab = table;
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
         @SuppressWarnings("unchecked")
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
< prev index next >