Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (2.6k points)

What is Java equivalent for LINQ?

1 Answer

0 votes
by (46k points)

The new stream and lambda function feature in Java 8 looks a lot like LINQ. You can do things like 

int sum = widgets.stream()

    .filter(w -> w.getColor() == RED) 

    .mapToInt(w -> w.getWeight())

    .sum();

which chains a stack of operators mutually and filters them using unknown functions. Check out java.util.stream (Java Platform SE 8 ) here.

 And there’s nothing like LINQ for Java in older versions. 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...