mirror of
https://github.com/corda/corda.git
synced 2025-06-18 15:18:16 +00:00
implement TreeSet.toString()
This commit is contained in:
@ -3,10 +3,10 @@ package java.util;
|
|||||||
public class Collections {
|
public class Collections {
|
||||||
private Collections() { }
|
private Collections() { }
|
||||||
|
|
||||||
static String toString(List l) {
|
static String toString(Collection c) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("[");
|
sb.append("[");
|
||||||
for (Iterator it = l.iterator(); it.hasNext();) {
|
for (Iterator it = c.iterator(); it.hasNext();) {
|
||||||
sb.append(it.next());
|
sb.append(it.next());
|
||||||
if (it.hasNext()) {
|
if (it.hasNext()) {
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
|
@ -17,6 +17,10 @@ public class TreeSet<T> implements Collection<T> {
|
|||||||
return new MyIterator<T>(set.first());
|
return new MyIterator<T>(set.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return Collections.toString(this);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean add(T value) {
|
public boolean add(T value) {
|
||||||
PersistentSet.Path<Cell<T>> p = set.find(new Cell(value, null));
|
PersistentSet.Path<Cell<T>> p = set.find(new Cell(value, null));
|
||||||
if (p.fresh()) {
|
if (p.fresh()) {
|
||||||
|
Reference in New Issue
Block a user