Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: "Program to an interface" - When to break a design pattern Date: Fri, 06 May 2011 12:17:55 -0400 Organization: albasani.net Lines: 23 Message-ID: References: <9dt5s6dalhetgfe99qs92c02hf0dbas44e@4ax.com> <2psjssq4zj.fsf@shell.xmission.com> <2poc3gq3p2.fsf@shell.xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net iM6b4wDIPRqsPqB01rADAG8a+ObZ28SNbRDBandUdMBKfsYmELLcP5D35xJey2xctTNCM7yX2ymWIQ/Fv5sSgg== NNTP-Posting-Date: Fri, 6 May 2011 16:17:46 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="pnNl638BiVkwrY3zu8OBedB+/cGlSq5OLbObyL4caboX3yVIuW3OB0tVCouxFB5F7pcYDohjsRlRtWPpanhMSFm+D1N8nQ4z4Y+PNRWJW3XEpqm89Vzzg4In+sbae8f5"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: Cancel-Lock: sha1:UKDBVB/ySc7q5XoPcXU0YNv4qTY= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3695 On 05/06/2011 08:01 AM, Jukka Lahtinen wrote: > Lew writes: >> Jim Janney wrote: >>> The justification is not in the code shown, but in the accompanying >>> remark "I need the map to retain the insertion order." There's no >>> interface in the JRE that promises this, > >> other than >> >> you mean. > > But I'm looking at the SortedMap and LinkedHashMap javadocs, and it > seems to me that LinkedHashMap doesn't implement the SortedMap > interface. > So, defining the return value as SortedMap you'd have to change the > actual implementation class. Yes, noted multiple times so far. I was wrong. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg