Grouping list of objects where each object is 2 elements array
问题 List<Object[]> values = query.getResultList(); //values = [obj1,obj2,obj3] //obj1 = "1", "01"; //obj2 = "1", "02"; //obj3 = "1:, "03"; Map<String, List<String>> resultMap = values.stream().collect(Collectors.groupingBy(???)); I need a map grouped as - {"1",["01","02","03"]} I have seen few references but nothing seems to work. what should i put in place of "???" ? if you need anything else , kindly comment. Thanks in advance. ref : Shortcut for adding to List in a HashMap groupingby list of