So I have the following object:
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StakeHolderTypesDepartmentsNotifications {
private StakeholderTypeEntity stakeholderTypeEntity;
private StakeholderDepartmentEntity stakeholderDepartmentEntity;
private StakeholderEntity stakeholderEntity;
private StakeholderNotificationEntity stakeholderNotificationEntity;
}
So I initially had a list of this object, and I turned it into a Map<String, List<StakeHolderTypesDepartmentsNotifications>
where the key is stakeholderDepartmentEntity.getId()
:
Map<String, List<StakeHolderTypesDepartmentsNotifications>> map =
stakeholders.stream()
.filter(entry -> entry.getStakeholderDepartmentEntity() != null)
.collect(groupingBy(
entry -> entry.getStakeholderDepartmentEntity().getId()));
However now I would like the following:
Map<String, Map<String,List<StakeHolderTypesDepartmentsNotifications>>
Where the key of the top level map is stakeholderTypeEntity.getId()
, where the value is the Map from above, where the key is the stakeholderDepartmentEntity.getId()