
Show HN: SQL-like queries on in-memory Java collections/arrays - sangupta
https://github.com/sangupta/gather
======
joncampbelldev
I would recommend people to use a persistent collection library like Vavr
instead (many other options too).

It provides the same functionality but without string field references (a
disaster for refactoring). Additionally it won't require learning a new DSL
for basic comparisons because the logic is contained in normal Java code with
lambdas and method references.

this:

    
    
      Gather query = Gather.where("age").greaterThan(50).and("status").is("active");
      List<Employee> filtered = query.find(employees);
      

becomes this:

    
    
      List<Employee> filtered = employess.filter(e -> e.age > 50 && e.status.equals("active"));

~~~
sangupta
Gather was aimed at JDK 7 since there is still a lot of legacy code around.
For JDK 8, lambdas surely work better.

~~~
joncampbelldev
Fair enough, what's​ the performance hit of reflection like for larger
collection sizes? is this library intended for exploring data during
development or a production system?

~~~
sangupta
I ran some performance tests and added a basic caching layer on reflection -
that improved it by around 50% in the very basic of tests. You may look at the
results in README at
[https://github.com/sangupta/gather](https://github.com/sangupta/gather) repo.

------
attacomsian
It looks awesome, more like Microsoft LINQ. I used to love LINQ but it only
works good with MS SQL Server.

~~~
sangupta
Thanks. LINQ was definitely a part inspiration in its development. Let me know
if you would like more features to be baked in.

