开发者

Polymorphic HashTable like datastructure

I'm creating a client side cache object and one of the consumers of the cache needs a means of looking up data by type. Obviously I can't just have a map from class to data since that wouldn't retrieve subtypes of the class. Is there a 'standard' or well suited data structure for this kind of thing?开发者_开发知识库


Instead of using a HashTable, it'd be easier to use a tree, since a tree would easily represent the type heirarchy.


If you key you HashMap by Class objects it will behave exactly as you expect it to. There will be no lookup on "subtype".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜