The method added by this commit basically duplicates the toString() method of
standard Java collection. It also contains a mysterious call to Iterator.remove()
at the iteration end. This method has not been keep in Geotk.
Command line:
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r24819:24820 https://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/ModifiableMetadata.java
| Revision 24819 | Revision 24820 |
|---|---|
buffer.append(System.getProperty("line.separator", "\n"));
}
}
} |
buffer.append(System.getProperty("line.separator", "\n"));
}
}
/**
* Add the contents of a collection to the provided buffer.
* This convenience method is used for {@link #toString) implementations.
* Output will be: "label: [1,2,3]"
*
* @param buffer string buffer to add the collection contents to
* @param label label for easy identification
* @param collection source object
*/
protected static void appendCollection(final StringBuffer buffer, String label, Collection collection) {
buffer.append(label);
buffer.append(": [");
if (collection != null && !collection.isEmpty()) {
Iterator it = collection.iterator();
while (it.hasNext()) {
buffer.append(it.next().toString());
if (it.hasNext()) {
buffer.append(",");
}
}
it.remove();
it = null;
}
buffer.append("]");
}
} |