Fixed many bugs.

This commit is contained in:
didier amyot committed 2018-06-24 17:16:44 -04:00
1 parent ad924ca5c7
commit 174319293c
10 files changed
+227 -94

No files matched your search

+6 -4
View File
@@ -13,11 +13,11 @@ public class PersistentSortedList extends Obj implements Iterable, RandomAccess,
List, Counted{
final private PersistentTreeMap impl;
final private int _count;
static public final PersistentSortedList EMPTY = new PersistentSortedList(null, PersistentTreeMap.EMPTY, 0);
static private final PersistentSortedList EMPTY_DEFAULT_COMPARATOR = new PersistentSortedList(null, PersistentTreeMap.EMPTY, 0);
private int _hasheq = 0;
public static PersistentSortedList create(ISeq items){
PersistentSortedList ret = EMPTY;
PersistentSortedList ret = EMPTY_DEFAULT_COMPARATOR;
for(; items != null; items = items.next()){
ret = ret.cons(items.first());
}
@@ -52,7 +52,9 @@ public class PersistentSortedList extends Obj implements Iterable, RandomAccess,
@Override
public IPersistentCollection empty() {
return PersistentSortedList.EMPTY;
return new PersistentSortedList(null,
new PersistentTreeMap(null, this.impl.comp),
0);
}
@Override
@@ -142,7 +144,7 @@ public class PersistentSortedList extends Obj implements Iterable, RandomAccess,
@Override
public ISeq more() {
ISeq s = next();
return s == null ? PersistentSortedList.EMPTY : s;
return s == null ? (PersistentSortedList) empty() : s;
}
@Override