Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 23 Apr 2013 13:33:11 -0500 Date: Tue, 23 Apr 2013 19:33:09 +0100 From: lipska the kat <"nospam at neversurrender dot co dot uk"> Organization: Trollbusters 3 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: References: <9h4i4a-kvp.ln1@tempest.fredriksson.dy.fi> <25zdt.2945$N74.2063@newsfe10.iad> In-Reply-To: <25zdt.2945$N74.2063@newsfe10.iad> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <25-dnQ-mLoV6TuvMnZ2dnUVZ7oadnZ2d@bt.com> Lines: 52 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-muC5TjlK8lXvR27E07pEMstzJu1kxTJxR1gTKptSubZtgazak5EXfgqlQ9acf0GxvmlDp2mJyuim2cZ!FBjMlb9fuNea9gO708BiOKwrc27dvf4zBMvjNC/+9n1yjx4plMYi+NxHUKOehTFbyvLScOVvxRw= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3698 Xref: csiph.com comp.lang.java.programmer:23592 On 23/04/13 17:58, Daniel Pitts wrote: > On 4/23/13 9:30 AM, lipska the kat wrote: >> On 23/04/13 16:50, Daniel Pitts wrote: >>> On 4/23/13 8:37 AM, lipska the kat wrote: >>>> On 23/04/13 14:55, Steven Simpson wrote: >>>>> On 23/04/13 11:31, Donkey Hottie wrote: >>>>>> 23.04.2013 12:48, Steven Simpson kirjoitti: >>>>>>> public static String generateWindowsArgument(List >>>>>>> args) { >>>>>> java.lang.String is final, so nothing can extend it. >>>>>> >>>>> >>>>> It's a matter of habit drawn from the general principle that if I >>>>> don't >>>>> need to modify the list, I don't impose the additional, unnecessary >>>>> constraint on the caller, regardless of the element type. >>>> >>>> I don't understand this. In the first place List >>>> says >>>> nothing about your ability to modify the list, you can add and remove >>>> Strings to your hearts content, >>> Wrong. >>> >>> List listOfStuff = new ArrayList(); >>> >>> listOfStuff.add("foo"); // compiler error here! >> >> erk, you're right, well I never, however it doesn't say anything about >> the list outside of the method, how therefor does it avoid 'impose[ing] >> the additional, unnecessary constraint on the caller' what constraint >> does it avoid ? > In *this* case none. Actually, in a way, List as a parameter to a method might be considered as breaking encapsulation ... you are actually exposing part of the internal workings of a component. > In the General case. Yes well this isn't the general case and I'm not convinced that writing List as a parameter type because one day in the distant future String might be mutable is a reason to do it, it's nasty pointless and unnecessary complexity. Just my opinion of course. :-) lipska -- Lipska the KatŠ: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun