Integer set with continuous regions in Java

179 Views Asked by At

I would like to have int tree set implementation, which is optimized for sets with a lot of continuous regions.

For example, such tree could know that is contains entire region from 100 to 150 and hence searching for 120 ends once this region found.

Similarly, if set contains regions 500...506 and 508...600, then, once 507 is added, two regions are merged.

Similarly regions can be splitted if number removed

1

There are 1 best solutions below

0
sibnick On

I use SparseBitSet for a similar task.

Note that Guava RangeSet uses Integer not int