It's not a language feature but you could take a look at the CollectionUtils from the Apache Commons project. SetUtils.predicatedSet looks like a nice candidate, for example. Or ofcourse you could write something yourself

Yes I like Linq, makes things a little easy to read and manage. I wish Java had something like that for its collections, even if its just of JavaFx, it would be nice, hmm I wonder if its been suggested...

Well, keep in mind that your first example is a loop-through. Your SQL example is a select (indexed retrieval). Hashmaps get a little closer, but no, they're not exactly what you're looking for either.

You could stick a database on the backend of your game and use JDBC I suppose. *shrug*

Well, keep in mind that your first example is a loop-through. Your SQL example is a select (indexed retrieval). Hashmaps get a little closer, but no, they're not exactly what you're looking for either.

You could stick a database on the backend of your game and use JDBC I suppose. *shrug*

I don't know if princec wanted the whole "indexed retrieval" functionality of proper db request, or just a nice syntax (to me his post indicated the latter).

I personally feel that one of Java's strongest features is the simplicity of the language. If you're working on something where you really need special syntax, perhaps you could use another vm language such as groovy, jython or scala?I wouldn't want to see Java turn into C# because that could make it more difficult for newcomers to adopt it.

I used to think that too, until I tried to teach a 10 year old how to code using Java the other day. It was that point that I realised it's already about as complicated as it can be without becoming C++.

So if we look at the example I gave, and if you understand SQL, which is the nicer, easier to understand, cleaner code?

I just want to be able to type SQL queries directly in java source against Collections.

Cas

Intriguing idea.

However, I don't really agree that this should be a language feature. It provides no useful benefit to the execution of a program other than providing (some) satisfaction to certain type of programmers.

Well the JavaFX equivalent looks decent.. and it does run on the JVM and mix well with Java, etc.. It would still be a bit awkward to mix at the level needed to do what Cas is after. Maybe a small language extension to more easily mix Java and JavaFX could handle it though.

Nah, I'm sick of rubbish libraries that pretend to make something better in java but actually just add a bunch more crap to get around some missing thing in the language. I'd just like... a better language

I often use Python to quickly throw together simple tools.Perhaps Jython would suit you? It compiles to regular Java bytecode so you don't have write the entire application with Jython, only the parts where the Java language becomes a barrier.

However, I don't really agree that this should be a language feature. It provides no useful benefit to the execution of a program other than providing (some) satisfaction to certain type of programmers.

This could be accomplished with a library.

I agree - it's not the kind of thing that is worth making the language more complicated for.

But seriously, anyone who's used SQL would tend to find the expressiveness of SQL select/insert/delete statements far more easy to understand than mentally having to work out what an iterator's doing, and so on and on. It'd hide all that tedious stuff and just let you get on with succinctly specifying the logic of the operation rather than the minutae of how it actually goes about doing it.

And let's face it, C# is making some wonderful inroads in this area, as it is in all sorts of other areas. We're only talking an optional syntax here that the compiler can support too, not changing any existing stuff.

Why bother with Retroweaver nowadays when javac will do it for you? Just need to compile with -target jsr14. Of course, you'll still need to check that you don't use post-1.4 methods. I don't know a tool to do that, although writing one is easy (assuming you have the 1.4 libraries to test against, and that you're not using reflection).

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org