Atitit Implementation of Java LINQ and comparison with the stream API
1.1. The relationship between the Linq and stream APIs , and the main pros and cons 1
1.2. Scenarios for Linq and stream APIs 1
1.3. LINQ1 in Java
Linq comes from SQL, and we know that in the field of data query,SQL is a standardized DSL.
1.1.
the relationship between the Linq and stream APIs , and the main pros and cons
Stream is more generalized andLINQ is more specific, focusing on the DSL of data query . Linq is a specialized stream.
in addition,LINQ is more DSL , more convenient and concise.
The stream is relatively low-level , more flexible, but slightly verbose.
1.2.
Scenarios for Linq and stream APIs
LINQ is more useful for most occasions , after all, SQL is a standardized data query DSL API.
However, in a small number of occasions, simple query a list of the case, perhaps LINQ seems a bit verbose, thestream will be more concise.
in addition, using stream in non-data query areas is better.
1.3.
LINQ in Java
The Java jdk does not implement the LINQ APIby default. Only third-party class libraries are implemented.
Although Java has a linq4j class library, but seemingly compiled, but not good use, had to implement the LINQ API itself.
Java implements LINQ, mainly using the static import
For example, the implementation of a list to do group aggregation query. For example, according to the monthly statistics recharge total amount
list result = Select ( Span style= "FONT-FAMILY:CALIBRI; Font-size:10.5000pt ">" month,sum (RECHG) as Total " " month " " total,desc "
author:: Nickname :Old Wow's claws( Full Name::AttilaxAkbar Al Rapanui Attilaksachanui)
Kanji Name: Etila ( Ayron) , email:[email protected]
reprint Please indicate source: http://www.cnblogs.com/attilax/
Atiend
Atitit implementation of Java LINQ and comparison with the stream API