[solved]Implementation with multiple values for each key?

Discussion in 'Plugin Development' started by civ77, Jan 27, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    Is there a Collection Implementation which can store multiple values for a single key? (It doesn't matter what the key is or how it is assigned.)
  2. Offline


    Create a new class that stores all the values, then use a normal Map.
  3. how about:
    Map<String, List<Object>> multipleValuesForSingleKey;
    civ77 likes this.
  4. Offline


    how do I get the information that are in the lists?
  5. depending if you just want to store values and iterate through them or if they should have a key themselves.
    for(Object listObject : multipleValuesForSingleKey.get(keyForList))
      // do whatever with the object...
    otherwise you could do that:
    Map<String, Map<String, String>> multipleValuesForSingleKeyWithSubKeys;
    but thats not really efficient. Another way would be the one nisovin mentioned.
Thread Status:
Not open for further replies.

Share This Page