You must know that you can combine Collector s. See Collectors.groupingBy(Function,Collector)
Map<Integer, Integer> byId=risks.stream.collect( Collectors.groupingBy(Risk::getId, Collectors.summingInt(Risk::getRiskValue)));
You can also combine it with the first operation:
Map<Integer, Integer> byId=results.stream().map(Risk::new).collect( Collectors.groupingBy(Risk::getId, Collectors.summingInt(Risk::getRiskValue)));
Note that I assume that you have the getRiskValue() method in your Risk class, otherwise you need to replace Risk::getRiskValue lambda expression r -> r.riskValue to access the field, however, it is always recommended to use getter methods.
Result displays from id to total.
After reviewing the question again, I noticed that you really want to summarize riskValue and store it in totRisk for each (?) Risk instance. This is a bit more complicated as it does not fit the general usage pattern:
Map<Integer, List<Risk>> byId=results.stream().map(Risk::new).collect( Collectors.groupingBy(Risk::getId, Collectors.collectingAndThen( Collectors.toList(), l-> { int total=l.stream().collect(Collectors.summingInt(r -> r.riskValue)); l.forEach(r->r.totRisk=total); return l; })));
at this point, we really need to switch to using import static java.util.stream.Collectors.*; :
Map<Integer, List<Risk>> byId=results.stream().map(Risk::new).collect( groupingBy(Risk::getId, collectingAndThen(toList(), l-> { int total=l.stream().collect(summingInt(r -> r.riskValue)); l.forEach(r->r.totRisk=total); return l; })));