-1

Possible Duplicate:
LINQ for Java tool

In C# there is a capability to use LINQ statements in order to access a Collection as if writing a SQL statement. I would like to create a similar plug-in for Java and was wondering you guys had any advice for how to go about doing this? I would like to make it as similar to SQL as possible.

Community
  • 1
  • 1
Craig Locke
  • 755
  • 4
  • 8
  • 12

1 Answers1

0

Well this is quite difficult to do in java since LINQ is built and integrated into the C# language. If I were to do this, I would probably create a class for all actions in MySQL: for example "Select", "Join"... and then make methods for actions you would like to conduct on them. Select(...).From where "From" is a method on the Select class. This is a very simplified example of course, but what you need to do is create a SQL compiler in Java, and then add any custom methods or classes you would want.

A word of caution however, LINQ is more efficient than writing loops in C#, however if you were to write your own custom Java LINQ, you would simply be writing shortcuts. What I am trying to say is that, you will not be making your code any more efficient, simply more readable and compact.

Suraj Kulkarni
  • 207
  • 3
  • 6