X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=exo2%2FListExtension.java;h=df2c789ccfca45e3d89721e8a09a406b3e2931f5;hb=e1499f74d5264f2205c54bf9b1a4c66fd447a844;hp=a015be584fac6be368afe04642437fefb587fd49;hpb=54c717d48cc5408be4d7960771dfabc1d7f486e6;p=Project_POO.git diff --git a/exo2/ListExtension.java b/exo2/ListExtension.java index a015be5..df2c789 100644 --- a/exo2/ListExtension.java +++ b/exo2/ListExtension.java @@ -1,7 +1,8 @@ import java.util.List; import java.util.ListIterator; +import java.util.AbstractList; -public class ListExtension { +public class ListExtension extends AbstractList { private List list; public ListExtension() { @@ -28,20 +29,34 @@ public class ListExtension { return list; } - public boolean add(E e) { - return list.add(e); + /** + * [get description] + * @param index [description] + * @return [description] + */ + public E get(int index) { + return list.get(index); } + /** + * [size description] + * @return [description] + */ public int size() { return list.size(); } + public boolean add(E e) { + return list.add(e); + } + /** - * Should mimic the List add(int index, T value) method - * @param value [description] - * @return [description] + * Should mimic the List add(int index, E value) method + * @param index [description] + * @param value [description] + * @return [description] */ - public void addIter(int index, E value) { + public void add(int index, E value) { ListIterator iter = list.listIterator(); int i = 0; // go to the element at index + 1