I have a collection of the following type:
class Container
{
private String startValue;
private String endValue;
}
Let's say it contains these entries...
{"123, "789"},
{"1", "8"},
{"9", "10"},
Then I want to ask the collection to give me all entries which satisfy the predicate between start and end values of each Container, such as the String "5" parameter would return the two first entries above (but not the last one) whereas "9" would only return the first one (and so on).
It should behave as SQL BETWEEN operator on a VARCHAR column.
Changing type from String is not an option. Changing data structure is not an issue.
Performance is also a very importan here. The data structure is rarely changed, but retrieval is very common. A bit extra space taken if speed can be gained is also fine.
Any ideas?
satisfy the predicate between start and end values of each Container. can you please explain it a bit?