简体   繁体   English

Java的链表类的自定义节点类

[英]custom node class with java's linkedlist class

Been a while since I used java. 自从我使用Java以来​​已经有一段时间了。 I want to use Java's built in linkedlist class but I want a custom node class that has children and siblings. 我想使用Java的内置链表类,但是我想要一个具有子代和同级的自定义节点类。 How can I write a custom node class that Java's linked list will use? 如何编写Java链表将使用的自定义节点类? Just a matter of creating the node class and declaring a linkedlist class but just create a new constructor that will override javas? 只需创建节点类并声明链表类,而只需创建一个将覆盖Java的新构造函数即可? Thanks! 谢谢!

LinkedList uses a private Node<E> class internally. LinkedList在内部使用私有Node<E>类。 If this is just an academic exercise, given that the source code is available you could just start with that and go from there. 如果这只是一个学术活动,鉴于源代码可用,您可以从此开始然后从那里开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM