当我定义DListNode
时,我需要三个变量。我无法弄清楚哪些是哪个。
DListNode doubleCur = new DListNode(var1,var2,var3);
每个var对应什么? (我知道一个是节点,另外两个是链接,但我在哪个顺序定义它们?)
答案 0 :(得分:0)
DListNode
是一个自定义类,因此它取决于它的实现方式。
无论如何,下面怎么样?
...
...
...
public Object item;
protected DListNode prev;
protected DListNode next;
/**
* DListNode() constructor.
* @param i the item to store in the node.
* @param p the node previous to this node.
* @param n the node following this node.
*/
DListNode(Object i, DListNode p, DListNode n) {
item = i;
prev = p;
next = n;
}
寻找" DListNode"在Google上,第一和第二个结果已经提供了选项;)