From: Lawrence D'Oliveiro Newsgroups: comp.lang.java.programmer Subject: Re: Binary Search Followup-To: comp.lang.java.programmer Date: Sun, 03 Apr 2011 12:40:08 +1200 Organization: Geek Central Lines: 16 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 1301791211 5333 118.92.92.183 (3 Apr 2011 00:40:11 GMT) X-Complaints-To: abuse@ihug.co.nz NNTP-Posting-Date: Sun, 3 Apr 2011 00:40:11 +0000 (UTC) User-Agent: KNode/4.4.7 Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!feed.ac-versailles.fr!uvsq.fr!freenix!newsfeed.berkeley.edu!ucberkeley!i.newsfeed.yosemite.net!newsfeed.yosemite.net!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2785 In message , Mike Schilling wrote: > "Leif Roar Moldskred" wrote in message > news:PtmdncL-dvk-3wrQnZ2dnUVZ876knZ2d@telenor.com... > >> Mike Schilling wrote: >>> >>> For a SortedMap, specify a Comparator that knows. >> >> Eh? How is that going to give you a key? > > It's going to give you an ordering for the binary search. The Python folks discovered this the hard way: providing a comparator callback is slow. It’s better to provide a key-accessor callback, and let the sort algorithm do the comparison.