Isn't the original version (with direct copy into TreeSet) faster?

Just being pedantic btw, as this is probably on a cold path, so we don't really care :)