harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r379169 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
Date Mon, 20 Feb 2006 17:15:04 GMT
Author: tellison
Date: Mon Feb 20 09:15:02 2006
New Revision: 379169

URL: http://svn.apache.org/viewcvs?rev=379169&view=rev
Log:
Enhance toString() to handle self referencing collections

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java?rev=379169&r1=379168&r2=379169&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
Mon Feb 20 09:15:02 2006
@@ -275,8 +275,13 @@
 		buffer.append('[');
 		Iterator it = iterator();
 		while (it.hasNext()) {
-			buffer.append(it.next());
-			buffer.append(", "); //$NON-NLS-1$
+			Object next = it.next();
+			if (next != this) {
+				buffer.append(next);
+			} else {
+				buffer.append("(this Collection)");
+			}
+			buffer.append(", ");
 		}
 		// Remove the trailing ", "
 		if (buffer.length() > 1)



Mime
View raw message