2 import java
.util
.ListIterator
;
4 public class ListExtension
<E
> {
7 public ListExtension() {
11 public ListExtension(List
<E
> l
) {
16 * [setList description]
17 * @param l [description]
19 public void setList(List
<E
> l
) {
24 * [getList description]
25 * @return [description]
27 public List
<E
> getList() {
31 public boolean add(E e
) {
40 * Should mimic the List<E> add(int index, T value) method
41 * @param index [description]
42 * @param value [description]
43 * @return [description]
45 public void addIter(int index
, E value
) {
46 ListIterator
<E
> iter
= list
.listIterator();
48 // go to the element at index + 1
49 while (iter
.hasNext() && i
<= index
) {
56 //FIXME: replace parameter by the list of objects to add
57 public void addNelements(int index
, int Nelements
) {
58 ListIterator
<E
> iter
= list
.listIterator();
60 // go to the element at index + 1
61 while (iter
.hasNext() && i
<= index
) {
65 for (int j
= 0; j
< Nelements
; j
++) {
66 iter
.add((E
)new Object());