Java实现单链表: 链表中的节点。key代表节点的值,next是指向下一个节点的指针。
package com.primer.structure.single_list;
/**
* 单链表节点
* @author sd
*/
public class Node_Single {
public String key; // 节点的值
public Node_Single next; // 指向下一个的指针
public Node_Single(String key) { // 初始化head
this.key = key;
this.next = null;
}
public Node_Single(String key, Node_Single next) {
this.key = key;
this.next = next;
}
public String getKey() {
return key;
}
}