I have a situation where I'd like to be able to enter two
string keys and get back an integer value.
I've tried doing this with a nested HashMap, but it really doesn't work the way I was doing it.
I was trying to create the nested entry in hash maps like this:
this.mapUserNames.put("Fred",mapUserType.put("User",1)); // 1 is perm.
Is there a way in
Java to do this?
The code above compiles OK, but trying to retrieve the value using the opposite approach just gives me null.
So, I'd like to be able to enter: something like someMethod("Fred", "User") and get back Fred's permission. I don't want to have to do a DB lookup each time so I want to be able to store all the user name - user type values along with the related permission in some structure that I can access quickly like a map.
Look forward to any replies.
Thanks.
Mike