commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danny Lagrouw <danny.lagr...@gmail.com>
Subject Convert list to map
Date Mon, 05 Sep 2005 07:27:57 GMT
Hi all,

I need to do a lot of list-to-map conversions, and I'm looking for a way to 
use commons collections for this. I would like to do something like this:

Map map = ListUtils.toMap(list, new SomeTransformerInterface() {
void insertIntoMap(Object object, Map map) {
SpecificObject s = (SpecificObject) object;
map.put(s.getId(), s.getDescription());
}
});

Does something like this exist?
-- 
Regards,
Danny Lagrouw
Java Developer, Profict b.v.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message