开发者

What is the best Guava (Google) collection API to represent direct or inverse relationship between two or multiple factors?

BiMap do have inverse method but I am not sure it is a right collection to use for the problem. Can someone please suggest alternative approach or collection/method? An example would be help开发者_开发百科ful.

Thanks in advance. Prakash


Could you show a simple code sample of how you would use such a data structure?

Should keys / values be unique? In this case, BiMap sounds about right.

If keys / values are not unique, you want some kind of "BiMultimap" (also called a "graph"), as discussed in this Guava discussion thread. Google has not (yet?) open sourced their own internal BiMultimap.

If you want a graph, you might want to look at JUNG or Flexigraph, as discussed in the thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜