8 comments

[ 1.9 ms ] story [ 31.5 ms ] thread
It looks awesome, more like Microsoft LINQ. I used to love LINQ but it only works good with MS SQL Server.
Thanks. LINQ was definitely a part inspiration in its development. Let me know if you would like more features to be baked in.
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"));
Gather was aimed at JDK 7 since there is still a lot of legacy code around. For JDK 8, lambdas surely work better.
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?
I haven't done performance benchmarking, nor tuned it yet. That's my next plan. The library is largely meant for firing ad-hoc queries in production, or for tweaking data-sets and database queries.

Though reflection is slower, it allows us to fire queries on List<Object> sort of collections and the built in type conversions may allow us to compare a Calendar instance to a Date, or a Long to a String (with implicit parsing and conversions).

(comment deleted)
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 repo.