So I have a map that takes a Long as a key and a list as a value. I want both the map and the list in each entry to be unmodifiable.
Map<Long, List<VariantValueDto>> variantValues = productVariantValues.stream()
.map(p -> new VariantValueDto(
p.getProductVariantId(), p.getOptionId(), p.getOptionName(), p.getOptionValueId(), p.getValueName()
))
.collect(Collectors.groupingBy(VariantValueDto::getProductVariantId));
how to return such results?