|
@@ -5,12 +5,6 @@ import java.util.NoSuchElementException;
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
public class ConsEmptyList<E> implements ConsList<E> {
|
|
|
-
|
|
|
- private final int size;
|
|
|
-
|
|
|
- public ConsEmptyList() {
|
|
|
- this.size = 0;
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public Iterator<E> iterator() {
|
|
@@ -39,7 +33,8 @@ public class ConsEmptyList<E> implements ConsList<E> {
|
|
|
|
|
|
@Override
|
|
|
public boolean isEmpty() {
|
|
|
- return this.size == 0;
|
|
|
+ //Toujours vide
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -54,7 +49,8 @@ public class ConsEmptyList<E> implements ConsList<E> {
|
|
|
|
|
|
@Override
|
|
|
public int size() {
|
|
|
- return this.size;
|
|
|
+ //Toujours vide donc 0 element
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
@Override
|