This is what my table in the database looks like.
Num | Value |
---|
1 | 10 |
1 | 20 |
2 | 30 |
2 | 15 |
3 | 25 |
3 | 35 |
I'm fetching them from the database and I want to save value corresponding to 1, 2 and 3 in separate lists. I know (maybe!)
Map<Key, List<Integer>> is what I need but I don't know how to do it.
Output expected is:
Code is appreciated. Thanks in advance.