例如,如何返回数组中不同/唯一值的数量
int[] a = {1,2,2,4,5,5};
最佳答案
Set<Integer> s = new HashSet<Integer>();
for (int i : a) s.add(i);
int distinctCount = s.size();
关于Java(计算不同整数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1482232/