我没有发布整个代码。我有这个:
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;
}
}
我javac -Xlint LinkedList2.java
收到此错误:
LinkedList2.java:134: incompatible types
found : LinkedList2<T>.Node<T>
required: LinkedList2<T>.Node<T>
private Node<T> current = LinkedList2.this.head;
^
1 error
你能帮我吗?