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: Thu, 05 May 2011 17:24:38 -0400 Organization: albasani.net Lines: 22 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 p2JvhddT44lfW5RpHqwK2mvGupoXg8q/S7FbCVQtjCfg9FhoPSDW9EB7D+S3coe13I8fdvhsdtIRGkil15wAaw== NNTP-Posting-Date: Thu, 5 May 2011 21:24:35 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="eJ2YbPZg6CnGaJFjGj6inslEeIdTuR/nwAlS9fyLJzJvH+oVzdy8+6HxGeBnZhX1i2JYqQ9rseD8vbInkSVzcqOFmS6YWNmqRP33JUV+WmFBYkVpLOX4xEuClrEv32DP"; 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: <2poc3gq3p2.fsf@shell.xmission.com> Cancel-Lock: sha1:PbfiDrL9RJG5AxwuErvbRmrYCpE= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3600 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. > and only one class that provides it, which makes encapsulation, shall we say, difficult. Oh, really? Two are listed in the API docs for that "nonexistent" interface, and neither one is 'LinkedHashMap'. Knowing the collections API is a prerequisite for effective Java programming. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg