一直希望有个MapList这样的东西, 有k/v对,但是却是list形式存放的,可以排序.
List<String, String> maplist = new ArrayList<String, String>();
找过.没找到.今天写程序就突然想起来了,其实挺简单:
List<String[]> maplist = new ArrayList<String[]>();
String[] item = new String[2];
然后就是排序:
Arrays.sort(maplist, new Comparator(String[])
{
public int compare(String[] src, String des)
{
return src[0].compareTo(des[0]);
}
});
--
It's Hard to Define, But I Know it When I See it…
1 comment:
jakarta commons.collections 里面有个ListOrderedMap,看名字,应该是这种效果
Post a Comment