在java中表示树层次结构 [英] Represent tree hierarchy in java

查看:131
本文介绍了在java中表示树层次结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Java树数据结构?

我想表示一个层次java中的结构层次结构可以是

I want to represent a hierarchical structure in java. The hierarchy can be of the form

Key
|
|-Value1
|  |-Value11
|    |-Value111
|-Value2
|  |-Value22
|-Value3
|-Value4

任何人都可以建议我在java中代表这种层次结构的最好的数据结构?

Can anyone suggest me the best possible data structure to represent this kind of hierarchy in java?

推荐答案

看到这个答案:

Java树数据结构

基本上没有什么在标准库中,提供了一个开箱即用的树形表示,除了JTree在swing包中。

Basically, there is nothing in the standard libs that offers a Tree representation out of the box, except for the JTree in the swing package.

你可以自己滚动(在链接的答案),或使用那个,实际上很好。

You can either roll your own (some tips offered in the linked answer), or use that one, which works well actually.

这篇关于在java中表示树层次结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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