Sandesh Rana
Sandesh Rana

Reputation: 81

How to implement function signature for fold() function related to Java?

I am having problem to start the fold () function related to Java. Can you please help me to know how the structure of the fold function works. I am trying to use this method relating to generics of Java.

Upvotes: 0

Views: 90

Answers (1)

Marko Topolnik
Marko Topolnik

Reputation: 200236

By "fold" you probably mean "fold left", which is another name for "reduce". The Java Stream interface defines reduce, so I suggest inspecting that signature:

T reduce(T identity, BinaryOperator<T> accumulator)

Upvotes: 1

Related Questions