Procházet zdrojové kódy

Passage test append

Arthur Brandao před 6 roky
rodič
revize
77a7ff845c
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      src/migl/util/ConsListImpl.java

+ 3 - 1
src/migl/util/ConsListImpl.java

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