Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newspeer2.se.telia.net!newspeer3.se.telia.net!se.telia.net!fi.sn.net!newsfeed1.tdcnet.fi!news.song.fi!not-for-mail From: Jukka Lahtinen Newsgroups: comp.lang.java.programmer Subject: Re: "Program to an interface" - When to break a design pattern Organization: none References: <9dt5s6dalhetgfe99qs92c02hf0dbas44e@4ax.com> <2psjssq4zj.fsf@shell.xmission.com> <2poc3gq3p2.fsf@shell.xmission.com> X-no-archive: yes Content-Type: text/plain;charset="iso-8859-1" Content-Transfer-Encoding: 8bit Date: Fri, 06 May 2011 15:01:09 +0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:DjNWgnCskTT6/8OtnMFpMQ6aB5g= MIME-Version: 1.0 Lines: 18 NNTP-Posting-Host: 81.17.207.67 X-Trace: 1304683338 news.tdc.fi 2837 81.17.207.67:47183 X-Complaints-To: abuse@tdcnet.fi Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3675 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. -- Jukka Lahtinen