jdk8- "lambda

Using lambda expression scene (provided): one ⼀ Connector only Contains either Remedies, it can use the Lambda expressions, such Connector called "function-connector" Syntax: (params) -> expression
 
Part of the first frame in brackets in the form of a comma-separated Using parameters, parameter is a parameter Connector ⾥ ⾯ functional methods for the camera; second shot is a part ⼀ arrow symbols: ->; Remedies third part thereof, can be an expression and block
parameter list:
Parenthesis data type of the parameter list can be omitted
The parameters in parentheses ⼀ only one, then the parameter types and () can not write omitted
⽅法 body:
{If} ⼀ ⾏ code only, no matter if there is a return value, {} may be omitted, return, semicolon, is omitted from To turn, need to add others
 
Java8 built-in quad-core zoomed Center Weighted Functional Connector
Consumer <T>: consumer Connector: YES START parameters, no matter if the return value
void accept(T t);
Supplier <T>: Connector supply type: ⽆ START parameters, return value
T get();
Function <T, R>: Connector Type Function: YES START parameters, return value
R apply(T t);
Predicate <T>: OFF The language type Connector: YES START parameters, return value, the return value is a boolean type determination
boolean test(T t);

Guess you like

Origin www.cnblogs.com/yuefeng123/p/12153847.html