commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nentwig, Timo" <timo.nent...@jamba-ag.de>
Subject Modify getter result
Date Mon, 20 Dec 2004 14:08:26 GMT
Hi!

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
Timo

---------------------------------------------------------------------
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