Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 7423 invoked from network); 30 Mar 2005 09:41:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Mar 2005 09:41:07 -0000 Received: (qmail 42941 invoked by uid 500); 30 Mar 2005 09:40:59 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 42888 invoked by uid 500); 30 Mar 2005 09:40:59 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 42873 invoked by uid 99); 30 Mar 2005 09:40:59 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from smtpq1.home.nl (HELO smtpq1.home.nl) (213.51.128.196) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 30 Mar 2005 01:40:57 -0800 Received: from [213.51.128.135] (port=44018 helo=smtp4.home.nl) by smtpq1.home.nl with esmtp (Exim 4.30) id 1DGZh1-0006aN-4W for commons-user@jakarta.apache.org; Wed, 30 Mar 2005 11:40:55 +0200 Received: from cc210905-a.haren1.gr.home.nl ([217.121.104.93]:33853 helo=box01) by smtp4.home.nl with esmtp (Exim 4.30) id 1DGZgz-0005X0-Vu for commons-user@jakarta.apache.org; Wed, 30 Mar 2005 11:40:54 +0200 From: "rinke hoekstra" To: commons-user@jakarta.apache.org Date: Wed, 30 Mar 2005 11:42:29 +0200 MIME-Version: 1.0 Subject: [commons-collections]: how to do reverse iteration in TreeBidiMap Message-ID: <424A90A5.1407.CDDC03@localhost> Priority: normal X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-AtHome-MailScanner-Information: Neem contact op met support@home.nl voor meer informatie X-AtHome-MailScanner: Found to be clean X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi list, maybe a stupid question, or maybe I am missing something, but I cannot sort out how to do a reverse iteration over the values of a TreeBidiMap, and couldn't find much about it on the web. I want to retrieve the 10 greatest values from a HashMap, and thought it best to use a TreeBidiMap for it. I have this: TreeBidiMap bidiMap = new TreeBidiMap(myHashMap); OrderedBidiMap invMap = bidiMap.inverseOrderedBidiMap(); //creates inversed map OrderedMapIterator oit = invMap.orderedMapIterator(); while (oit.hasPrevious()) { Float value = (Float)oit.previous(); ..... } The iterator however seems to be initialized at the first element, so hasPrevious() is usually false, and the loop isn't run. How to initialize the iterator at the last element, so you can start iterating using hasPrevious()? thanks, Rinke --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org