* even if the iterator returns a different number of elements.
*/
@Override
public long[] toArray() {
long[] dest = new long[size()];
final TLongIterator it = iterator();
for (int i = 0; i < dest.length; i++) {
if (!it.hasNext()) // fewer elements than expected
return Arrays.copyOf(dest, i);
dest[i] = it.next();
}
return it.hasNext() ? finishToArray(dest, it) : dest;
}