listnode.java

来自「java版的数据结构的完全代码 免费提供了 学习数据结构的请下载」· Java 代码 · 共 44 行

JAVA
44
字号
// Introduced in Chapter 6/** Node in a linked list. */public class ListNode<E> implements Predecessor<E> {  /** The item stored in this node. */  private E item;  /** The node following this one. */  private ListNode<E> next;  /** Put item in a node with no next node. */  public ListNode(E item) {    this.item = item;    next = null;  }  /** Put item in a node with the specified next node. */  public ListNode(E item, ListNode<E> next) {    this.item = item;    this.next = next;  }  /** Return the item stored in this node. */  public E getItem() {    return item;  }  /** Return the next node. */  public ListNode<E> getNext() {    return next;  }  /** Replace the item stored in this node. */  public void setItem(E item) {    this.item = item;  }  /** Set the next node. */  public void setNext(ListNode<E> next) {    this.next = next;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?