Java Array Unique uniques(final int[] ints)

Here you can find the source of uniques(final int[] ints)

Description

uniques

License

Open Source License

Declaration

public static int uniques(final int[] ints) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static int uniques(final int[] ints) {
        final Set<Integer> set = new HashSet<Integer>();
        for (int i = 0; i < ints.length; i++) {
            set.add(ints[i]);/*from  w ww. j  av a 2  s. c  o  m*/
        }
        return set.size();
    }
}

Related

  1. unique(double[] in)
  2. unique(int[] a, int aLen, int[] b, int bLen)
  3. unique(int[] array)
  4. unique(Object[] elements)
  5. uniqueInts(int[] ints)