Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.lang.java.programmer Subject: Re: Binary Search Followup-To: comp.lang.java.programmer Date: Sat, 02 Apr 2011 22:00:24 +1300 Organization: Geek Central Lines: 21 Message-ID: References: NNTP-Posting-Host: 118-92-92-183.dsl.dyn.ihug.co.nz Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: lust.ihug.co.nz 1301734824 5477 118.92.92.183 (2 Apr 2011 09:00:24 GMT) X-Complaints-To: abuse@ihug.co.nz NNTP-Posting-Date: Sat, 2 Apr 2011 09:00:24 +0000 (UTC) User-Agent: KNode/4.4.7 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2732 In message , Mike Schilling wrote: > "Lawrence D'Oliveiro" wrote in message > news:imouja$56s$2@lust.ihug.co.nz... > >> In message , Roedy Green >> wrote: >> >>> The problem is, Map and SortedMap don't "map" well onto binary search. >>> binary search to work properly requires embedded keys. Maps require >>> them separate. >> >> Sounds like the Java Map classes are not well designed. > > Or that someone doesn't understand them. Embedded keys can be made to > work perfectly well with SortedMaps simply by making both arguments to > put() the same, and providing a comparator that can locate the key in the > object. So why isn’t there a single-argument overload of the put method to save you the trouble?