开发者

blackberry hashmap

what is the equivalent of

LinkedHashMap < String, String > postMap = 
    new LinkedHashMap < String, String >开发者_如何转开发;();

for Java 1.4 for Blackberry? I am trying to make a hashmap


Try Hashtable


There is no equivalent. Some additional collections-related classes are in net.rim.device.api.util, but nothing like hash map with predictable traversion order. Depending on a task, you might be better off with just a Vector - if there are only couple of dozen entries. Memory is kind of more precious than CPU on BB. If performance is unacceptable, then simply put a wrapper around Hashtable and store own class with class MyEntry { String key; String value; MyEntry prev,next; } as values.


I also wanted to use LinkedHashMap in BlackBerry because I wanted to implement an LRU cache.

Unfortunately LinkedHashMap isn't supported in BB so I found a nice sample code to implement this using only HashTable:

Generic LRU Cache

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜