|
@@ -47,7 +47,7 @@ public class ConsListImpl<E> extends Cons<E, ConsList<E>> implements ConsList<E>
|
|
|
}
|
|
|
|
|
|
private ConsList<E> appendRec(E e, ConsList<E> list) {
|
|
|
- if(list == null) {
|
|
|
+ if(list == null || list.isEmpty()) {
|
|
|
return new ConsListImpl<>(e, null);
|
|
|
}
|
|
|
return new ConsListImpl<>(list.car(), this.appendRec(e, list.cdr()));
|