commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "rinke hoekstra" <rin...@home.nl>
Subject Re: [commons-collections]: how to do reverse iteration in TreeBidiMap
Date Wed, 30 Mar 2005 14:36:03 GMT
Yes, I thought of that sollution.... 

It seems a good sollution. But still I am very curious to know how one would use 
hasPrevious().... 

I think I will just stop bothering about it and use your sollution. 

Rinke

> How about something like this?
> 
> TreeBidiMap bidiMap = new TreeBidiMap(myHashMap);
> Collection values = bidiMap.values()
> values.sort()
> values.reverse()
> for(Iterator i=values.iterator(); i.hasNext();) {
> 	Float value = (Float)i.next()
> }
> 
> I wouldn't worry about looping using hasPrevious(), I'd just reverse the
> collection so that it is in descending order.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message