Java的链表类的自定义节点类 [英] custom node class with java's linkedlist class

查看:301
本文介绍了Java的链表类的自定义节点类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直使用Java。我想使用Java的内置链表类,但我想要一个具有子代和同级的自定义节点类。如何编写Java链表将使用的自定义节点类?只需创建节点类并声明链表类,而只需创建一个将覆盖Java的新构造函数即可?谢谢!

Been a while since I used java. I want to use Java's built in linkedlist class but I want a custom node class that has children and siblings. How can I write a custom node class that Java's linked list will use? Just a matter of creating the node class and declaring a linkedlist class but just create a new constructor that will override javas? Thanks!

推荐答案

LinkedList 使用私有的内部的节点< E> 类。如果只是出于学术目的,请考虑源代码可用,您可以从此开始然后从那里开始。

LinkedList uses a private Node<E> class internally. If this is just an academic exercise, given that the source code is available you could just start with that and go from there.

这篇关于Java的链表类的自定义节点类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆