Originally Posted by
ober0330
You can't even see how frustrating those answers you give might be? Do you even understand what I said?
I understand what you said perfectly. Do you understand what I have said?
Originally Posted by
ober0330
Obviously the situation can vary greatly and every answer you might give might not be the perfect example every time. But if we all took that perspective, no one would ever give any answers at all.
I disagree. There's a difference between not giving any answers at all and giving an answer but adding a caveat that you're not guaranteeing that any solution is "best" for an unknown context. I gave you a reasonable approach. And since I didn't also include an SSCCE (which you yourself refused to include) showing you exactly how to do that, you got upset.
Originally Posted by
ober0330
Obviously I know people respond to these threads for free. But there are hundreds of boards out there exactly like this that don't point that out, as you seem to think you have to.
I didn't point it out until you overreacted and behaved as if you were entitled to some kind of special treatment. Everybody plays by the same rules here. When I have a question, I include an SSCCE. If I don't get the answer I'm looking for, I ask a more specific question. I don't throw tantrums at people who are trying to help me.
Originally Posted by
ober0330
My point is, you didn't even try to guess at what my problem might be at the beginning. You wanted a perfect example that absolutely replicated my problem but without all of the objects I'm using in my code. Do you know how pointless that is?
Why should we have to guess at what your problem is? It's your job to make it easy for us to help you. Why on earth would you want to make it harder for people to help you for free?
I entirely disagree that providing an SSCCE is pointless. It is the opposite of pointless. The reason I wanted an SSCCE was mostly because I wanted to see the Node class. A common problem when using HashMap is overriding equals() but not hashcode(). That can cause strange behaviors. But without seeing your Node class, and an example of how you use that class that I could play with, I'd simply be guessing, which is a huge waste of your time- and mine, and the time of the hundreds of other people here waiting on a reply.
However, your original question did not actually mention the specific problem of wanting to hold multiple values for each key. You said you didn't know how to check for existing values, but then the piece of code you did post actually contained a check for an existing value, which is why I said it was unclear and asked for the SSCCE. Seeing what you were actually trying to do would have gone a long way to help get an answer that wasn't "generic" (even though you labeled your second reply as a generic question, so a generic answer should have been all you hoped for).
I'll repeat myself again- simply concatenating the values is almost definitely not the best way to go. A better way to go would be to use a Map of Lists, as I said before. But it's your code, so feel free to do what you want. But don't complain when people don't tell you the best way to do things when you ignore the advice anyway.