Java Array Duplicate removeDuplicates(double[] array)

Here you can find the source of removeDuplicates(double[] array)

Description

remove Duplicates

License

Apache License

Declaration

public static double[] removeDuplicates(double[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static double[] removeDuplicates(double[] array) {

        double[] result = null;
        Map<Double, Object> values = new HashMap<Double, Object>(array.length);

        for (double value : array)
            values.put(value, new Object());
        {//from www  .  j a  v  a 2 s .  com
            int i = 0;

            result = new double[values.size()];

            for (double value : values.keySet())
                result[i++] = value;
        }

        return result;
    }
}

Related

  1. deleteDuplicatedPages(int[] pages)
  2. duplicateArrayEntries(String[] inputArr, int numDuplicates)
  3. eraseDuplicatedValue(String[] srcArr)
  4. hasDuplicates(final T[] array)
  5. isDuplicated(String[] strArray)
  6. removeDuplicates(final Object[] array)
  7. removeDuplicates(int[] input)
  8. removeDuplicates(T[] elements)
  9. removeDuplicatesInPath(int[][] path)