Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit4.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!53ab2750!not-for-mail From: "markspace" Subject: Re: SortedMap: getting value for largest key less or equal a given Message-ID: <501AC32B.55936.calajapr@time.synchro.net> X-Comment-To: Andreas Leitgeb Newsgroups: comp.lang.java.programmer In-Reply-To: <501AC32A.55935.calajapr@time.synchro.net> References: <501AC32A.55935.calajapr@time.synchro.net> X-FTN-AREA: COMP.LANG.JAVA.PROGRAMMER X-FTN-MSGID: 1:261/38 1c6869cd X-FTN-REPLY: 1:261/38 75e250bf Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.16a-Win32 NewsLink 1.98] Lines: 30 Date: Thu, 02 Aug 2012 19:11:58 GMT NNTP-Posting-Host: 69.21.70.65 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1343934718 69.21.70.65 (Thu, 02 Aug 2012 14:11:58 CDT) NNTP-Posting-Date: Thu, 02 Aug 2012 14:11:58 CDT Organization: tds.net Xref: csiph.com comp.lang.java.programmer:16975 To: Andreas Leitgeb From: markspace <-@.> On 8/1/2012 1:19 PM, Andreas Leitgeb wrote: > Andreas Leitgeb wrote: >> I've got an approach like the following, but I'm not entirely >> happy with it... > > It took me about an hour to compose that previous post, and not > only did a bug still hide in it ("map" instead of "m_map"), but > also: only five minutes after posting, it occurred to me that I > could also look at TreeMap's methods, rather than only at > SortedMap's, and thereby stumbled over the (new in 1.6) interface > NavigableMap. > > PS: return m_map.floorEntry(k).getValue(); // :-) > Case closed. It is my contention that any requests for help should contain a careful explanation of the problem and attempted solutions, plus an SSCCE. Then the author should save the request on disc and go to lunch. If no solution was discovered during lunch, then the request should be sent. I think there's a Dilbert cartoon about this. --- BBBS/Li6 v4.10 Dada-1 * Origin: Prism bbs (1:261/38) --- Synchronet 3.16a-Win32 NewsLink 1.98 Time Warp of the Future BBS - telnet://time.synchro.net:24