"Gonzalo A. Diethelm" <[EMAIL PROTECTED]> writes:
> [The only reason I'm pointing this out is because this seems
> to be a very common mistake, and I have seen it in different
> languages: at least in C, C++ and Java.]
>
>
>> getClient() throws YourOwnException
>> {
>> Vector singleClient = new Vector(1) (1)
>> singleClient = ClientPeer.doSelect(blah); (2)
>> [snip]
>> return (Client) singleClient.get(0);
>> }
>
> Having singleClient start as a 1-element Vector in (1) is useless.
> Whatever you assigned to singleClient in (1), it will be overwritten
> in (2) with the return value of doSelect(). Therefore, (1) is better
> left as
>
> Vector singleClient = null;
>
> For some reason, people seem to believe that if singleClient
> will end up as a 1-element Vector, it has to start life as such.
> This is, of course, unnecessary.
Or better yet:
List singleClient = ClientPeer.doSelect(blah);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>