Avoid an infinite loop in toString() for collections that directly include themselves

Review at http://gwt-code-reviews.appspot.com/962801


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8957 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/super/com/google/gwt/emul/java/util/AbstractCollection.java b/user/super/com/google/gwt/emul/java/util/AbstractCollection.java
index 8f123d8..ba12f5a 100644
--- a/user/super/com/google/gwt/emul/java/util/AbstractCollection.java
+++ b/user/super/com/google/gwt/emul/java/util/AbstractCollection.java
@@ -142,7 +142,8 @@
       } else {
         comma = ", ";
       }
-      sb.append(String.valueOf(iter.next()));
+      E value = iter.next();
+      sb.append(value == this ? "(this Collection)" : String.valueOf(value));
     }
     sb.append("]");
     return sb.toString();