问题描述
我仍然在寻找一个理想的解决方案。总而言之,我在Java中对电源子系统进行建模,我需要一个用于数据的定向非循环图(DAG)类型的容器。
I'm still seeking an ideal solution to this question. To summarize, I am modeling a power subsystem in Java and I need a Directed-Acyclic-Graph (DAG)-type container for my data.
我在C ++的标准模板库(STL)中找到了我所需要的。它是,它支持为同一个键存储多个数据值。我可以清楚地看到如何存储电力节点和密钥,以及它们的上游/下游连接作为值,可以用这个数据结构来取消。
I found exactly what I need in C++'s Standard Template Library (STL). It is the multiset, which supports storing multiple data values for the same key. I can clearly see how storing power nodes and keys, and their upstream/downstream connections as values, could be pulled off with this data structure.
我的客户有一个hard-要求我用Java编写电源子系统模型,所以我需要一个与STL multiset相同的数据结构。我可以自己动手,但是在游戏的晚期,我不能承担犯错误的风险。
My customer has a hard-requirement that I write the power subsystem model in Java, so I need a data structure identical to the STL multiset. I could potentially roll my own, but it's late in the game and I can't afford the risk of making a mistake.
我非常失望的是,Java在Tree / Graph集合中非常轻。
I'm supremely disappointed that Java is so light on Tree / Graph collections.
Java中的多集类型结构?
Has anyone found an multiset-type structure in Java?
推荐答案
查看。特别是和。
这篇关于Java中是否有一个STL-Multiset等效容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!