0
我的自编的双LinkedList有问题。我有测试程序,它测试我的想法并且无限运行。问题出在方法WyswietlListe()中,其中condition!isDone()总是为真。我的isDome()方法有什么问题?我加在他们附近恒星被发现更容易为你:)使用自编的LinkedList迭代器的无限迭代
和测试:
public class Program {
public static void main(String[] args) {
Lista lista = new Lista();
Iterator iterator = lista.iterator();
Student s1 = new Student("Kowalski", 3523);
Student s2 = new Student("Polański", 45612);
Student s3 = new Student("Karzeł", 8795);
Student s4 = new Student("Pałka", 3218);
Student s5 = new Student("Konowałek", 8432);
Student s6 = new Student("Kłopotek", 6743);
Student s7 = new Student("Ciołek", 14124);
lista.insert(0, s1);
lista.insert(0, s2);
lista.insert(0, s3);
lista.insert(0, s4);
lista.insert(0, s5);
lista.wyswietlListe();
lista.infoOStanie();
lista.clear();
lista.infoOStanie();
}
}
噢是的男人!这就是我需要的:)我试图将isDone()更改为current == current.next.value == null。它解决了无穷大的问题,但列表没有正确打印。现在一切运行良好。谢谢 :) – RIPI