SyntaxFix
Write A Post
Hire A Developer
Questions
You could use Guava Ranges
You can get a SortedSet by using
SortedSet
ImmutableSortedSet<Integer> set = Ranges.open(1, 5).asSet(DiscreteDomains.integers()); // set contains [2, 3, 4]