memoize construction of ranges, and use transient/mutable Java collections for internal collection state