--- a/jdk/src/share/classes/java/util/AbstractCollection.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/AbstractCollection.java Wed Dec 01 21:46:52 2010 +0000
@@ -96,14 +96,14 @@
* @throws NullPointerException {@inheritDoc}
*/
public boolean contains(Object o) {
- Iterator<E> e = iterator();
+ Iterator<E> it = iterator();
if (o==null) {
- while (e.hasNext())
- if (e.next()==null)
+ while (it.hasNext())
+ if (it.next()==null)
return true;
} else {
- while (e.hasNext())
- if (o.equals(e.next()))
+ while (it.hasNext())
+ if (o.equals(it.next()))
return true;
}
return false;
@@ -269,18 +269,18 @@
* @throws NullPointerException {@inheritDoc}
*/
public boolean remove(Object o) {
- Iterator<E> e = iterator();
+ Iterator<E> it = iterator();
if (o==null) {
- while (e.hasNext()) {
- if (e.next()==null) {
- e.remove();
+ while (it.hasNext()) {
+ if (it.next()==null) {
+ it.remove();
return true;
}
}
} else {
- while (e.hasNext()) {
- if (o.equals(e.next())) {
- e.remove();
+ while (it.hasNext()) {
+ if (o.equals(it.next())) {
+ it.remove();
return true;
}
}
@@ -304,9 +304,8 @@
* @see #contains(Object)
*/
public boolean containsAll(Collection<?> c) {
- Iterator<?> e = c.iterator();
- while (e.hasNext())
- if (!contains(e.next()))
+ for (Object e : c)
+ if (!contains(e))
return false;
return true;
}
@@ -331,11 +330,9 @@
*/
public boolean addAll(Collection<? extends E> c) {
boolean modified = false;
- Iterator<? extends E> e = c.iterator();
- while (e.hasNext()) {
- if (add(e.next()))
+ for (E e : c)
+ if (add(e))
modified = true;
- }
return modified;
}
@@ -362,10 +359,10 @@
*/
public boolean removeAll(Collection<?> c) {
boolean modified = false;
- Iterator<?> e = iterator();
- while (e.hasNext()) {
- if (c.contains(e.next())) {
- e.remove();
+ Iterator<?> it = iterator();
+ while (it.hasNext()) {
+ if (c.contains(it.next())) {
+ it.remove();
modified = true;
}
}
@@ -395,10 +392,10 @@
*/
public boolean retainAll(Collection<?> c) {
boolean modified = false;
- Iterator<E> e = iterator();
- while (e.hasNext()) {
- if (!c.contains(e.next())) {
- e.remove();
+ Iterator<E> it = iterator();
+ while (it.hasNext()) {
+ if (!c.contains(it.next())) {
+ it.remove();
modified = true;
}
}
@@ -421,10 +418,10 @@
* @throws UnsupportedOperationException {@inheritDoc}
*/
public void clear() {
- Iterator<E> e = iterator();
- while (e.hasNext()) {
- e.next();
- e.remove();
+ Iterator<E> it = iterator();
+ while (it.hasNext()) {
+ it.next();
+ it.remove();
}
}
@@ -442,18 +439,18 @@
* @return a string representation of this collection
*/
public String toString() {
- Iterator<E> i = iterator();
- if (! i.hasNext())
+ Iterator<E> it = iterator();
+ if (! it.hasNext())
return "[]";
StringBuilder sb = new StringBuilder();
sb.append('[');
for (;;) {
- E e = i.next();
+ E e = it.next();
sb.append(e == this ? "(this Collection)" : e);
- if (! i.hasNext())
+ if (! it.hasNext())
return sb.append(']').toString();
- sb.append(", ");
+ sb.append(',').append(' ');
}
}