去除数组中重复的那个数字

阅读 146

2023-02-15


去除数组中重复的那个数字_i++

 

@Test
public void test8() {
Integer a[] = {1, 2, 3, 4, 5, 4};
Integer b = FindNUmber(a);
System.out.println(b);
}


private static Integer FindNUmber(Integer[] a) {
Map map = new HashMap();

for (int i = 0; i < a.length; i++) {

if (map.containsKey(a[i])) {
continue;
}
map.put(a[i], a[i]);
}
return null;
}

 

相关推荐

精彩评论(0)

0 0 举报