Home > Back-end >  Java was introduced into the Function
Java was introduced into the Function

Time:03-06

How does Java pass in a Function?

The first is an interface
 
Public interface Result extends Iterator {
List Keys ();

Boolean hasNext ();

Record next ();

Record in use () throws NoSuchRecordException;

Record the peek ();

Stream The stream ();

List The list ();

List The list (Function Var1);

ResultSummary consume ();
}


This Result is used to receive query returns data, I use the first list (), namely List The list ();
The second is how to use excuse me?

 
String sqlText="MATCH (N: WechatDepartment) - [child] - & gt; (M: WechatDepartment) \ n + "
"WHERE N.d epartmentId={departmentId} \ n" +
"RETURN ID (M) as ID, m. epartmentId as departmentId, M.n ame as the name, M.o rder as order, M.e nable as enable";
Result the Result=session. The run (sqlText paramentMap);

//method 1
List Records.=the result list ();
System. The out. Println (" records: "+ records. The size ());
For (Record Record: records) {
Map RecordMap=record. AsMap ();
System. The out. Println (recordMap);

String name=record. Get (" name "). The asString ();
System. The out. Println (" name: "+ name);
}

//method 2
?????

CodePudding user response:

Functional programming, can pass in a logical,
Proposal set point check the forEach method, can understand

CodePudding user response:

reference 1st floor HHBZZ response:
functional programming, can pass in a logical,
Proposal set point check the forEach method, can understand the

Can an example? Thank you very much!
  • Related