Arthur Brandao 6 anni fa
parent
commit
b620c410b6
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8 2
      src/migl/util/ConsListImpl.java

+ 8 - 2
src/migl/util/ConsListImpl.java

@@ -43,8 +43,14 @@ public class ConsListImpl<E> extends Cons<E, ConsList<E>> implements ConsList<E>
 
 	@Override
 	public ConsList<E> append(E e) {
-		// TODO Auto-generated method stub
-		return null;
+		return appendRec(e, this);
+	}
+	
+	private ConsList<E> appendRec(E e, ConsList<E> list) {
+		if(list == null) {
+			return new ConsListImpl<>(e, null);
+		}
+		return new ConsListImpl<>(list.car(), this.appendRec(e, list.cdr()));
 	}
 
 	@Override