2 java arrays unique distinct
例如,如何返回数组中不同/唯一值的数量
int[] a = {1,2,2,4,5,5};
Meh*_*ari 13
Set<Integer> s = new HashSet<Integer>(); for (int i : a) s.add(i); int distinctCount = s.size();
归档时间:
16 年,2 月 前
查看次数:
5945 次
最近记录: