I have two tables in my database i.e. Menu and Sub\_Menu... I have retrieved the data from those two tables using JOIN queries and it looks like this 

```
`SELECT menu.menu_name AS menu_name, sub_menu.sub_menu_name FROM menu LEFT JOIN user_category ON menu.user_category_id = user_category.user_category_id LEFT JOIN sub_menu ON menu.menu_id = sub_menu.menu_id WHERE user_category.user_category_name = "Normal";`

```

After this what i have done is I have used `LinkedHashMap<String, String>` to store the results. Now, the problem rises here. When I print the output, the last value of the duplicate key is only displayed and others are omitted... What i want to display is a unique key with multiple values.. I have tried it using `LinkedHashMap<String, ArrayList<String>>` but can't get it right !!!

`

```
LinkedHashMap<String, ArrayList<String>> menuSubMenu = new LinkedHashMap<String, ArrayList<String>>();`

`ArrayList<String> subMenu = null;`

`String key = null;`

            while (rs.next()) {
                key = rs.getString("menu_name");

                if (key.equals(rs.getString("menu_name"))) {
                    key = rs.getString("menu_name");
                    subMenu = new ArrayList<String>();
                    subMenu.add(rs.getString("sub_menu_name"));
                } else {
                    subMenu = null;
                }

                menuSubMenu.put(key, subMenu);
            }

```