--- a/jdk/src/share/classes/java/util/HashMap.java Fri Dec 20 09:58:03 2013 +0000
+++ b/jdk/src/share/classes/java/util/HashMap.java Fri Dec 20 13:38:13 2013 +0100
@@ -344,13 +344,13 @@
*/
static Class<?> comparableClassFor(Object x) {
if (x instanceof Comparable) {
- Class<?> c; Type[] ts, as; Type t; ParameterizedType p;
+ Class<?> c; Type[] ts, as; ParameterizedType p;
if ((c = x.getClass()) == String.class) // bypass checks
return c;
if ((ts = c.getGenericInterfaces()) != null) {
- for (int i = 0; i < ts.length; ++i) {
- if (((t = ts[i]) instanceof ParameterizedType) &&
- ((p = (ParameterizedType)t).getRawType() ==
+ for (Type t : ts) {
+ if ((t instanceof ParameterizedType) &&
+ ((p = (ParameterizedType) t).getRawType() ==
Comparable.class) &&
(as = p.getActualTypeArguments()) != null &&
as.length == 1 && as[0] == c) // type arg is c
@@ -875,8 +875,8 @@
public boolean containsValue(Object value) {
Node<K,V>[] tab; V v;
if ((tab = table) != null && size > 0) {
- for (int i = 0; i < tab.length; ++i) {
- for (Node<K,V> e = tab[i]; e != null; e = e.next) {
+ for (Node<K, V> e : tab) {
+ for (; e != null; e = e.next) {
if ((v = e.value) == value ||
(value != null && value.equals(v)))
return true;
@@ -923,8 +923,8 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (int i = 0; i < tab.length; ++i) {
- for (Node<K,V> e = tab[i]; e != null; e = e.next)
+ for (Node<K, V> e : tab) {
+ for (; e != null; e = e.next)
action.accept(e.key);
}
if (modCount != mc)
@@ -967,8 +967,8 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (int i = 0; i < tab.length; ++i) {
- for (Node<K,V> e = tab[i]; e != null; e = e.next)
+ for (Node<K, V> e : tab) {
+ for (; e != null; e = e.next)
action.accept(e.value);
}
if (modCount != mc)
@@ -1030,8 +1030,8 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (int i = 0; i < tab.length; ++i) {
- for (Node<K,V> e = tab[i]; e != null; e = e.next)
+ for (Node<K, V> e : tab) {
+ for (; e != null; e = e.next)
action.accept(e);
}
if (modCount != mc)
@@ -1275,8 +1275,8 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (int i = 0; i < tab.length; ++i) {
- for (Node<K,V> e = tab[i]; e != null; e = e.next)
+ for (Node<K, V> e : tab) {
+ for (; e != null; e = e.next)
action.accept(e.key, e.value);
}
if (modCount != mc)
@@ -1291,8 +1291,8 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (int i = 0; i < tab.length; ++i) {
- for (Node<K,V> e = tab[i]; e != null; e = e.next) {
+ for (Node<K, V> e : tab) {
+ for (; e != null; e = e.next) {
e.value = function.apply(e.key, e.value);
}
}
@@ -1771,8 +1771,8 @@
void internalWriteEntries(java.io.ObjectOutputStream s) throws IOException {
Node<K,V>[] tab;
if (size > 0 && (tab = table) != null) {
- for (int i = 0; i < tab.length; ++i) {
- for (Node<K,V> e = tab[i]; e != null; e = e.next) {
+ for (Node<K, V> e : tab) {
+ for (; e != null; e = e.next) {
s.writeObject(e.key);
s.writeObject(e.value);
}