0
我得到了需要分组的对象数组列表。数组包含不同类型的对象。 下面是一个例子:按分组列表排列
List<Object[]> resultList = query.getResultList(); // call to DB
// Let's say the object array contains objects of type Student and Book
// and Student has a property Course.
// Now I want to group this list by Student.getCourse()
Map<String, Object[]> resultMap = resultList.stream().collect(Collectors.groupingBy(???));
我怎么提供给Collectors.groupingBy()
方法? Student对象位于对象数组中的索引0处。