Atitit implementation of Java LINQ and comparison with the stream API

Source: Internet
Author: User
Tags stream api

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.