All Downloads are FREE. Search and download functionalities are using the official Maven repository.

shz.core.node.IDNode Maven / Gradle / Ivy

There is a newer version: 2024.0.2
Show newest version
package shz.core.node;

/**
 * 元素类型为int的双向链表节点
 * 

* 24*n(n为元素个数) *

* B=16+24*n */ public class IDNode implements DNode { private static final long serialVersionUID = 4737624808077729153L; public int val; protected IDNode next; protected IDNode prev; protected IDNode(int val) { this.val = val; } public static IDNode of(int e) { return new IDNode(e); } public static IDNode of() { return of(0); } @Override public final IDNode next() { return next; } @Override public final void next(IDNode node) { next = node; } @Override public final IDNode prev() { return prev; } @Override public final void prev(IDNode node) { prev = node; } public final IDNode addNext(int e) { return addNext(of(e)); } public final IDNode addNext(int... es) { IDNode next = this; for (int e : es) next = next.addNext(e); return next; } public final IDNode addPrev(int e) { return addPrev(of(e)); } public final IDNode addPrev(int... es) { IDNode prev = this; for (int e : es) prev = prev.addPrev(e); return prev; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy