I have a
List<Map<String, Object>>
coming from a Spring NamedParameterJdbcTemplate queryForList call. The data return looks like this:
[{"id":5,"uid":6}, {"id":5,"uid":7}, {"id":6,"uid":8}, {"id":7,"uid":7}, {"id":8,"uid":7}, {"id":8,"uid":9}]
How can I rearrange the data in the following format?
{5:[6, 7], 6:[8], 7:[7], 8:[7, 9]}
Im looking to return a Map<Integer, List<Integer>>
Anyone have an idea how I can achieve this? Any help much appreciated??