accumulate() is an instance method, and you reference it by name and class name (and not by instance name and method). Therefore, if I wanted to call the method that you give me, I would usually do myEx.accumulate(myCh) . Thus, I provide two things: an instance of WordCounterEx and a character. Therefore, using this method, the method is calculated as BiFunction<WordCounterEx, ? super Character, WordCounterEx> BiFunction<WordCounterEx, ? super Character, WordCounterEx> .
If instead you gave me, for example, this::accumulate , an object to call the on method would be specified ( this ), and it can no longer be used as a BiFunction (in my Eclipse I get a "Reduce (U, BiFunction, BinaryOperator) method) in type Stream is not applicable for arguments (WordCounterEx, this :: accumulate, WordCounterEx :: comb) ".)
source share