Tuesday, November 6, 2001 09:00 AM
I don't think the situation is as bad as you think. The objects that form your keys can be reused in each map. So if you have 1000 maps, then one object can serve as a key in all of them at the same time.
If your keys are strings, then you can benefit from an important property of string literals. Each time the same string appears in your program, it is the same object. So as long as you use literals (not new String("key"), for example) then you needn't worry about creating an excessive number of objects.
If your keys aren't strings, then you might consider using a singleton pattern. Search the FAQ for the term "singleton". There should be tons of information there.