Added a proper implementation of TreeSet, based on a Persistent set implementation.

This commit is contained in:
Eric Scharff
2007-09-28 11:01:57 -06:00
parent 8a4d3effe0
commit 5691ec87f0
4 changed files with 750 additions and 69 deletions

View File

@ -0,0 +1,24 @@
package java.util;
public class Cell <T> {
public T value;
public Cell<T> next;
public Cell(T value, Cell<T> next) {
this.value = value;
this.next = next;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("(");
for (Cell c = this; c != null; c = c.next) {
sb.append(value);
if (c.next != null) {
sb.append(" ");
}
}
sb.append(")");
return sb.toString();
}
}