我有一个HashMap<Float[], Integer>
,我可能需要将它转换为TreeMap
。 TreeMap的键(即数组)如何排序?由他们的第一个元素?按键排列映射键
我要运行一个简单的测试,但它导致了错误莫名其妙:
public class treeMapTest {
public static void main(String[] args) {
Integer arr1[] = {9, 0, 3};
Integer arr2[] = {2, 2, 2};
Integer arr3[] = {4, 2, 1};
TreeMap<Integer[], Integer> tm = new TreeMap<Integer[], Integer>();
tm.put(arr1, 7);
tm.put(arr2, 7);
tm.put(arr3, 7);
System.out.println(tm);
}
}
谢谢。
奇怪,我从来没有见过错误*莫名其妙;-) – domsson