What is Java equivalent for LINQ?
there is a project called quaere
its a java framework which adds abilitiy to query collections
LINQ is syntactical sugar which must be implemented in the compiler. No such thing is currently being done as far as I know for javac or the Eclipse java compiler.
Hence, no LINQ.
There are many LINQ equivalents for Java, see here for a comparison.
For a typesafe Quaere/LINQ style framework, consider using Querydsl. Querydsl supports JPA/Hibernate, JDO, SQL and Java Collections.
I am the maintainer of Querydsl, so this answer is biased.
You can select the items in a collection (and much more) in a more readable way by using the lambdaj library
http://code.google.com/p/lambdaj/
It has some advantages over the Quaere library because it doesn't use any magic string, it is completely type safe and in my opinion it offers a more readable DSL.
A more C#-like solution is JaQue. It has both: linq-to-object/xml functionality and a provider model with API very similar to MS LINQ. A simple JPA (Hibernate) provider is implemented. After Java will get closures, it will be elegant as well.
See SBQL4J. It's type-safe strong query language integrated with Java. Allows to write complicated and multiply nested queries. There is a lot of operators, Java methods can be invoked inside queries so as constructors. Queries are translated to pure Java code (there is no reflection at runtime) so execution is very fast.
EDIT: Well, so far SBQL4J it's the ONLY extension to Java language which gives query capabilities similar to LINQ. There are some interesting project like Quaere and JaQue but they are only API's, not syntax / semantics extension with strong type safety in compile time.
Dont worry about LINQ, Microsoft themselves have moved ahead away from LINQ with the entity framework, which is basically hibernate or JPA.
I developed a alternate solution, Coollection. Is simple and focused on the most used actions of iteration over Collections.
Use like that:
from(people).where("name", eq("Arthur")).first(); from(people).where("age", lessThan(20)).all(); from(people).where("name", not(contains("Francine"))).all();