[concurrency-interest] private field
Fri, 15 Oct 2004 13:11:24 +1000
> Ah I see. My gut reaction is that we should have had a drainTo(T ta)
Actually that would be a bit more awkward implement than it might seem. If
the array size is determined a priori then it may not match the collection
size when the actual drainTo occurs. If the array is too small a naive
implementation of drainTo would result in the excess contents being lost.
But even if drainTo tries to be clever and re-insert the excess contents
back into the collection, you then have the problem that a contains(x) query
could fail even though x is in the collection and will still be there after
Bottom line: you must be able to guarantee that everything in the collection
at the time drainTo is invoked, can be stored in the object your are
draining into so that nothing can be lost, or disappear and reappear.