More than one unique key for HashMap problem (Java)
Posted
by Alex Cheng
on Stack Overflow
See other posts from Stack Overflow
or by Alex Cheng
Published on 2010-04-24T14:58:10Z
Indexed on
2010/04/24
15:03 UTC
Read the original article
Hit count: 147
This question is a continuation of this thread:
In short: To solve my problem, I want to use Map<Set<String>, String>
.
However, after I sort my data entries in Excel, remove the unnecessary parameters, and the following came out:
flow content ==> content content
flow content ==> content depth distance
flow content ==> content depth within
flow content ==> content depth within distance
flow content ==> content within
flow content ==> content within distance
I have more than one unique key for the hashmap if that is the case. How do I go around this... anyone have any idea?
I was thinking of maybe Map<Set <String>, List <String>>
so that I can do something like:
Set <flow content>, List <'content content','content depth distance','content depth within ', ..., 'content within distance'>
But because I am parsing the entries line by line I can't figure out the way how to store values of the same repeated keys (flow content) into the same list and add it to the map.
Anyone have a rough logic on how can this be done in Java?
Thanks in advance.
© Stack Overflow or respective owner