This is a more general design question that anyone can comment on. I've created multiple methods that return vectors of like objects, and other methods that return arrays of like objects. Which is the best way to deal with return values?
I see the value of returning type-specific arrays, but when the number of elements aren't known, it's easier to create a Vector or an ArrayList object and return that. I do understand how easy it is to convert a Vector or ArrayList into an array, but is that the best thing to do?
I also see the issue of having to cast the returned Vector (or ArrayList) when dealing with the return value.
Any comments or experiences with this issue would be appreciated.
Thanks much,
Mike Lundin
I see the value of returning type-specific arrays, but when the number of elements aren't known, it's easier to create a Vector or an ArrayList object and return that. I do understand how easy it is to convert a Vector or ArrayList into an array, but is that the best thing to do?
I also see the issue of having to cast the returned Vector (or ArrayList) when dealing with the return value.
Any comments or experiences with this issue would be appreciated.
Thanks much,
Mike Lundin