I have a task to add in treeset > 10000000 elements that are sequence.
If I use
for (long index = 0; index < 10000000; index++)
{
result.add(index);
}
It takes 8083 ms. Is there any solution to increase the performance of this task?
https://github.com/cyberterror/TestRanges
P.S. The fastest way at the moment is: List<Integer> range = IntStream.range(0, 10000000).boxed().collect(Collectors.toList());
with result of ~ 370 ms