News for hackers. Stuff that matters.
Re:Java 12 by scarface74 on Wednesday March 20, 2019 @11:25AM (#19443102)
I can't tell from looking at the examples, but can I do things like pass around arbitrary expressions:

  Person.Get(p => (p.Age > 65 && p.Sex == "M") || (p.Age > 63 && p.Sex == "F"))
and have a method

  public List<Person> Get(Expression<Func<Person,bool>> expression)
and have that expression interpreted correctly at run time by separate providers?

You get full compile time checking and IDE supported autocomplete.

Re:Java 12 by spricket on Wednesday March 20, 2019 @12:41PM (#19443950)
Yes. But it's done in a different way than C#. C# supports fields and field references so you can pass them directly to a function.

The Java code "looks" like they do the same because they generate code to simulate method references instead. It's pretty clever and Javas code generation support for Annotation Processors is excellent and makes it possible to do this in a cross-ide cross-build-system way

LINQ and JOOQ/QueryDSL all work on plain data objects with fields. But with Java you do it on a pseudo object generated from your existing classes

Re:Java 12 by scarface74 on Wednesday March 20, 2019 @12:55PM (#19444105)
That's really interesting.

All of these years I've been beating up on Java for lack of something akin to LINQ. I guess I'll have to find something else to complain about.....

Re:Java 12 by spricket on Wednesday March 20, 2019 @03:56PM (#19446196)
IMO LINQ is still better because of how integrated into the language it is. JOOQ and QueryDSL were basically designed to replicate it as much as possible but not nearly to convenience levels of LINQ + Entity Framework