My list contains sets like [1,3,5][2,6,4] etc, all of the same size. I tried doing this but it doesn\'t seem to work.
[1,3,5][2,6,4]
List&g
If you have guava on the classpath this is a breeze:
guava
block .stream() .flatMap(Set::stream) .collect(Collectors.toCollection(TreeSet::new)); Iterable> result = Iterables.partition(sorted, 3);