Hello! I am trying to make a method that takes the first Map whose values are sets and a second empty Map whose values are Lists and fills the second Map with the same key/value Mappings as the first. The 2nd map will have every key in the 1st Map, but associated with it is a List of all the same elements that are in the Set it maps to. Use the ArrayList in the Second Map. Here is the method I got.
public static<K,E> void values(Map<K, Set<E>> ml, Map<K, List<E>> m2){
for (Map.Entry<K, Set<E>> e; e < ml.size(); ? // I am not sure what to write here: a e.hasNext() or a e.next)
// then i have to use a put method right?
m2.put(e.getKey(), new ArrayList<E>(? )) // I don't know how to get the value, would it just be the same as e.getKey() or e.value
}
Can you tell me how you would do this? or if there is anything wrong? Thank you for your help