Best way to create a hashmap of arraylist
You don’t need to re-add the ArrayList back to your Map. If the ArrayList already exists then just add your value to it. An improved implementation might look like: Map<String, Collection<String>> map = new HashMap<String, Collection<String>>(); while processing each line: String user = user field from line String value = value field from line Collection<String> … Read more