Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Using getSelectedValuesList() instead of the deprecated getSelectedValues() Date: Mon, 16 Jul 2012 18:05:53 -0700 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: <34011151-6528-4f4c-815c-df9e8353cb71@googlegroups.com> <_40Nr.24747$cE7.24028@newsfe13.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 17 Jul 2012 01:05:55 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="9645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Axaa0VeBmuPnCa1P3o3bOrRgZKKR+am0=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: Cancel-Lock: sha1:DTbPrbIz/mXkfEUD3V7k2+DIxf4= Xref: csiph.com comp.lang.java.programmer:16057 On 7/16/2012 4:47 PM, Jeff Higgins wrote: > On 07/16/2012 05:55 PM, Daniel Pitts wrote: >> On 7/16/12 1:13 PM, Jeff Higgins wrote: >>> I think the java.util.List interface has a method to return an array. >>> >> Indeed it does, but that is terrible advice. > str_array = jLst.getSelectedValuesList().toArray(); > > Is that much better? I think Daniel is saying "prefer Lists to arrays", but then we don't know the OP's complete requirements. If a List will do, then the List form is better. If the OP must have an array, then I'd say one call that returns an array is better than doing the same thing with two calls.