I had an idea for a project a while back wherein I was going to write a Java library to allow sorting and selection from arrays using an SQL syntax of sorts.
My idea was that you could select from the array like this:
int[] nums = new int[] { 0, 5, 7, 2, 4, 9, 3, 1, 6, 8 }
int result = select().from(nums).where("value > 2").and("value < 8").sort("ASC");
This would return a new array like this:
{ 3, 4, 5, 6, 7 }
I haven't really thought of much of an implementation or a reason for doing this, but I think it would be a very interesting endeavor.
My question is, does anything like this exist? Or is there any special way I should go about this?
I was also thinking this could be useful for Object
arrays, where you could select multiple fields, like this:
select().from(array).where("Field1 = "+someValue).or("Field1 = "+anotherValue);
And the possibilities go on and on. But I'm unsure exactly where to start, or better put, how to start implementing these methods.
This is more of a "where to go" than a question with an answer, so any help at all will be useful.