如何获取Node组件的链表? [英] How to get Node component in linked list?

查看:136
本文介绍了如何获取Node组件的链表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

了解如何反向链接 - 列表列表。链接非常具有描述性和清晰度。但不知何故,我没有得到
如何获取需要传递到以下方法的Node组件。我没有在 LinkedList $找到任何方法b $ b得到节点。对不起,询问愚蠢的问题,但在网络上的任何地方,假设我们得到了Node组件,然后从那里获得程序strats

  public void recursiveReverse(Node currentNode){
...
}


解决方案

您将不得不从头开始编写自己的LinkedList类来实现该方法。 java.util.LinkedList 不会公开其内部实现。例如,节点被称为条目,而该类 java.util.LinkedList.Entry 是私有的。


Learnt how to reverse-a-linked-list list. Link is very descriptive and clear. But somehow i am not getting how to get the Node component which needs to be passed to below method. I did not find any method under LinkedList to get the Node. Sorry for asking dumb question but everywhere on net , assumption is we got the Node component some and then program strats from there

    public void recursiveReverse(Node currentNode ){
    ...
    }

解决方案

You'll have to write your own LinkedList class from scratch to implement that method. java.util.LinkedList doesn't expose its internal implementation. For example, the nodes are called entries instead, and that class, java.util.LinkedList.Entry, is private.

这篇关于如何获取Node组件的链表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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