Monday, September 19, 2022

[FIXED] What is the difference between Unary-Operator functional-interface to Consumer functional-interface?

Issue

I was wondering what is the difference between Unary-Operator and Consumer functional interfaces?

Eventually, both of them get a function and apply it to a generic T.

Thank you in advance!


Solution

A Consumer is a method that take a parameter of a generic type T and has no return value (void). A UnaryOperator is a method that take a parameter of a generic type T and return a value of the same type (T).



Answered By - vincendep
Answer Checked By - Willingham (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.