In Cocoa's Objective-C, we have the NSIndexSet class, which effectively stores a number of unique indices, while maintaining an array of ranges. For example. set 1, 2, ... 30, 57 will be stored as ranges 1-30 and 57, and not an array of 32 numbers. This makes it easy to store huge samples in a quick and easy way. For example, if all rows are between 1 and one million in the selected table, the set of indices collapses to just a small range and quickly compares and intersects with.
Unfortunately, for Google this is quite complicated. Is there an equivalent class for Java?
java indexing cocoa range
Alexander Ljungberg
source share