I think you should start by defining what sum means. It would appear to mean the transverse sum of the range of that relation, or the total of the right halves of each pair. Is that right?
How are you storing those pairs? Are they in a List, or are they “K” and “V” in a Map?
Let's guess you have a Pair<Character, Integer> and you are putting it into a List.
so far, so good. Now work out what you are going to get as the return value of this call:-
pairs.stream();
Alternatively, run this code on an IDE; if you use Eclipse and hover your mouse over the name of the method “stream”, a little popup will appear with its return type on.
Once you have got that working, look in the
Java™ Tutorials about Lists and
about nested classes (especially λs) and
Stream's methods to see what you might be able to do. Hint: you want to get
ints because you can summate them. Tell us how far you have got and I shall be out of circulation for some time, so somebody else will probably help you.