You are on page 1of 1

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

import java.util.LinkedList;
import java.util.ListIterator;
/**
* contenedor de locales
*/
public class Contenedor extends LinkedList{
public ListIterator listIterator() {
return
new ListIterator(){
private int indice = 0;
public void add(Object o) {}
public boolean hasNext() {
return true;}
public boolean hasPrevious() {
return true;}
public Object next() {
return indice == size() ? get(indice = 0) : get(indice++);
}
public int nextIndex() {
return indice == size() - 1 ? 0 : indice + 1;}
public Object previous() {
return null;}
public int previousIndex() {
return indice == 0 ? size() - 1 : indice - 1;}
public void remove() {}
public void set(Object o) {}
};
}
}

You might also like