Java Array Duplicate removeDuplicateValues(double[] values)

Here you can find the source of removeDuplicateValues(double[] values)

Description

remove Duplicate Values

License

Open Source License

Declaration

public static double[] removeDuplicateValues(double[] values) 

Method Source Code

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

public class Main {
    public static double[] removeDuplicateValues(double[] values) {
        System.err.println("removeDuplicateValues() not tested");

        if (values == null)
            return null;

        java.util.ArrayList res = new java.util.ArrayList(values.length);
        for (int i = 0; i < values.length; i++) {
            Double d = new Double(values[i]);
            if (!res.contains(d))
                res.add(d);/* www  . ja v a2s.c  o m*/
        }

        double[] resValues = new double[res.size()];
        for (int i = 0; i < resValues.length; i++) {
            resValues[i] = ((Double) res.get(i)).doubleValue();
        }
        return resValues;
    }
}

Related

  1. removeDuplicates(final Object[] array)
  2. removeDuplicates(int[] input)
  3. removeDuplicates(T[] elements)
  4. removeDuplicatesInPath(int[][] path)
  5. removeDuplicateStrings(String[] array)