0 votes
1 view
in Java by (2.6k points)

What is Java equivalent for LINQ?

1 Answer

0 votes
by (46.1k 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
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...