result = temp.data
是我的陈述
public T getEntry(int givenPosition) {
T result = null;
if(root ==null)
return null;
else{
DNode temp = root;
for(int i=0;i<givenPosition;i++){
//if(temp !=root.nextNode){
temp = temp.nextDNode;
//lala = temp.data;
// }
}
result = temp.data;
}
return result;
}
public class DNode <T> {
T data;
DNode nextDNode;
DNode previousDNode;
DNode(T data){
this.data = data;
numberOfEntries++;
}
}
答案 0 :(得分:2)
尝试使用temp
制作T
,即DNode<T> temp = root;