Also you can use RangeSet, now public in Guava 14.