【发布时间】:2012-05-28 21:47:16
【问题描述】:
更新:-
问题陈述是-
我需要储存这些东西-
For ID corresponding to 1, I need to Store these things
- Key CGUID(String CGUID) and its Value, Key SGUID(String SGUID) and its Value, Key PGUID(String PGUID) and its Value, Key UID(String UID) and its Value, Key ALOC(String ALOC) and its Value
For ID corresponding to 2, I need to Store these things
- Key CGUID(String CGUID) and its Value, Key SGUID(String SGUID) and its Value, Key PGUID(String PGUID) and its Value, Key UID(String UID) and its Value, Key ALOC(String ALOC) and its Value
For ID corresponding to 3, I need to Store these things
- Key CGUID(String CGUID) and its Value, Key SGUID(String SGUID) and its Value, Key PGUID(String PGUID) and its Value, Key UID(String UID) and its Value, Key ALOC(String ALOC) and its Value
所以对于这个问题,我正在考虑制作这样的数据结构-
public static LinkedHashMap<String, Integer> GUID_VALUES = new LinkedHashMap<String, Integer>();
public static LinkedHashMap<Integer, LinkedHashMap<String, Integer>> GUID_ID_MAPPING = new LinkedHashMap<Integer, LinkedHashMap<String, Integer>>();
还有比这更好的方法吗?
【问题讨论】:
-
泛型用于类型,而不是值。
-
听起来像是一棵支持基于路径的查询的树,比如 XPath。
-
是 CGUID 键和值,与 ID 1 和 ID 2 相关,换句话说,它将是相同的映射或结构(这也适用于其他键/值对)?
-
通过 CGUID 键我的意思是字符串 CGUID,我用更多信息更新了问题。
-
再看评论,我已经编辑好了。
标签: java hashmap linkedhashmap