开发者

Primitive ordered collection in java

开发者 https://www.devze.com 2023-03-24 04:10 出处:网络
Trove library provides some fast primitive collections, eg Map, List, but it does not have any ordered collection, eg SortedMap, T开发者_如何学PythonreeSet. Is there a library that provides those coll

Trove library provides some fast primitive collections, eg Map, List, but it does not have any ordered collection, eg SortedMap, T开发者_如何学PythonreeSet. Is there a library that provides those collections?


Try http://fastutil.dsi.unimi.it/ for some giant ordered structures, but perhaps not all that you want.


There is also LinkedMap and ListOrderedMap from the Common Collection library.

OrderedMap map = new LinkedMap();
map.put("FIVE", "5");
map.put("SIX", "6");
map.put("SEVEN", "7");
map.firstKey();  // returns "FIVE"
map.nextKey("FIVE");  // returns "SIX"
map.nextKey("SIX");  // returns "SEVEN"
0

精彩评论

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