commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nentwig, Timo" <>
Subject Modify getter result
Date Mon, 20 Dec 2004 14:08:26 GMT

I'm not sure whether this can be done with commons-collections. 

I need to hook in a collection and return a default value when the
requested key does not exist in the collection. E.g.

Map currency = new HashMap()
		put("DE", "EUR");
		put("US", "USD");

And currency.get("XY") is supposed to return a default value (this may
require additional logic and e.g. may write to the logger that an yet
unsupported ISOCODE was requested).

Can this be done?

Kind regards

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message