custom node class with java's linkedlist class

强颜欢笑 提交于 2019-12-25 18:23:09

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/44360545/custom-node-class-with-javas-linkedlist-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!