my2iu / Jinq

LINQ-style queries for Java 8
Other
659 stars 71 forks source link

[Feature] Add support for additional collection libraries #117

Open nicklundin08 opened 6 months ago

nicklundin08 commented 6 months ago

Hello!

First off, awesome project - I love using this library as someone who comes from a .NET background πŸš€


One of the Java projects Im working on currently makes use of both JINQ as well as Vavr for collections. One of the things that is kind of annoying is unwrapping all of the vavr types into JVM collection types before passing them into query expressions.

In the example below, the dbCustomers1 query wont work but the dbCustomers2 query will.

var customerIds = io.vavr.List.of("id1", "id2"); //Maybe this comes from an API input or something like that)

var dbCustomers1 = db.stream(CustomerDAO.class)
  .where(c -> customerIds.contains(c.getId())     // Wont work - Jinq doesnt know about vavr collection types
  .collect(io.vavr.List.collector());

var customerIdsAsJavaList = customerIds.toJavaList();

var dbCustomers1 = db.stream(CustomerDAO.class)
  .where(c -> customerIdsAsJavaList .contains(c.getId()) // Will work - happy JINQ noises
  .collect(io.vavr.List.collector());

In this project we also use jackson. They have a module approach to this where you can register custom collection types like this

Im curious if you'd be open to supporting the ability to register other collection types somehow (either by module or some other means).

Thanks!

my2iu commented 6 months ago

Jinq isn't currently under active development. It's in maintenance mode where I just make sure that it continues to run on newer versions of Java and fix any bugs that may arise. No new features are currently planned unless one is urgently needed for some use case.

nicklundin08 commented 6 months ago

No worries. Thanks for all the hard work thus far

my2iu commented 6 months ago

I'll keep the issue open, just to keep track of things that could be improved with the project.