Estoy intentando recorrer una lista Queue en java. he creado un método para recorrer la cola que se llama recorrerEspera(). Estoy usando eclipse por lo que intente esto: listaEspera.peek().get(i), pero no me reconoce el metodo get(i).
import java.util.Collection;
import java.util.Iterator;
import java.util.Queue;
public class ColeccionVehEspera {
Queue<Vehiculo> listaEspera;//= new Queue<Vehiculo>();
public ColeccionVehEspera() {
this.listaEspera = new Queue<Vehiculo>() {
@Override
public boolean addAll(Collection<? extends Vehiculo> arg0) {
// TODO Auto-generated method stub
return false;
}
@Override
public void clear() {
// TODO Auto-generated method stub
}
@Override
public boolean contains(Object arg0) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean containsAll(Collection<?> arg0) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
@Override
public Iterator<Vehiculo> iterator() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean remove(Object o) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean removeAll(Collection<?> c) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean retainAll(Collection<?> c) {
// TODO Auto-generated method stub
return false;
}
@Override
public int size() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Object[] toArray() {
// TODO Auto-generated method stub
return null;
}
@Override
public <T> T[] toArray(T[] a) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean add(Vehiculo e) {
// TODO Auto-generated method stub
return false;
}
@Override
public Vehiculo element() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean offer(Vehiculo e) {
// TODO Auto-generated method stub
return false;
}
@Override
public Vehiculo peek() {
// TODO Auto-generated method stub
return null;
}
@Override
public Vehiculo poll() {
// TODO Auto-generated method stub
return null;
}
@Override
public Vehiculo remove() {
// TODO Auto-generated method stub
return null;
}
};
}
public void recorrerEspera() {
for (int i = 0; i < listaEspera.size(); i++) {
System.out.println(listaEspera.peek());
}
}
}