Let’s see the source code that follows this implementation. This means an object of type “T” is input to the lambda with no return value. 1.1.1 Function Descriptor of ConsumerĬonsumer’s function descriptor is T -> (). Since Consumer is a functional interface, hence it can be used as the assignment target for a lambda expression or a method reference. A common example of such an operation is printing where an object is taken as input to the printing function and the value of the object is printed. taken as an input and some operation is to be performed on the object without returning any result. The consumer can be used in all contexts where an object needs to be consumed, i.e. 1.1 What is Consumer?Ĭonsumer is an in-built functional interface introduced in Java8 in the package.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |