|
As mentioned, when copying out of a list you should use a for or a while, not a do/while. Do while's indicate that its guaranteed to perform the first action, whilst your list is currently empty so you cannot retrieve the first item. You can use a try/catch of course.
It may be a lot easier to simply invoke the .clone() method on the primary list though and use that copy. Its shallow clone, but if its just for sorting for whatever reason than that is fine.
If the problem is adding to the collection, post that code.
|