Uso genérico com problemas de classe interna
Eu não estou postando o código inteiro. Eu tenho isto:
public class LinkedList2<T extends Comparable<T>> implements Iterable<T> {
private Node<T> head;
private Node<T> tail;
private int numOfElem;
private class Node<T> {
Node<T> next;
T data;
Node(Node<T> next, T data) {
this.next = next;
this.data = data;
}
}
private class LinkedList2Iterator<T> implements Iterator<T> {
private int count = LinkedList2.this.numOfElem;
private Node<T> current = LinkedList2.this.head;
}
}
Emjavac -Xlint LinkedList2.java
Eu recebo este erro:
LinkedList2.java:134: incompatible types
found : LinkedList2<T>.Node<T>
required: LinkedList2<T>.Node<T>
private Node<T> current = LinkedList2.this.head;
^
1 error
Você pode ajudar?