I have this piece of code that is driving me crazy. I don't understand how my map can contain two values on one line and on the very next line be null without me doing anything to it. Here is the code with the output

Turns out using rolesList.clear() wasn't good enough to actually clear my list and had to be replaced by rolesList = new ArrayList<String>();

Does the clear method not "Removes all of the elements from this list (optional operation). This list will be empty after this call returns (unless it throws an exception)." because no exception was being thrown here?

05-11-2009, 09:58 PM

OrangeDog

Quote:

Originally Posted by xcallmejudasx

It has been changed to

Code:

groupRoleInfoMap.get((groups.get(xx)))

No need for double brackets.

Quote:

Originally Posted by xcallmejudasx

Turns out using rolesList.clear() wasn't good enough to actually clear my list and had to be replaced by rolesList = new ArrayList<String>();

I don't see any clear() in your code.

You might have less trouble if you wrote a Multimap class yourself to handle the adding to mapped lists. This would keep your collection-handling code separate and you'd be less likely to make mistakes.