Java Utililty Methods Array Duplicate

List of utility methods to do Array Duplicate

Description

The list of methods to do Array Duplicate are organized into topic(s).

Method

ListremoveDuplicates(T[] elements)
Returns a duplicate-free list of an array.
final int n = elements.length;
final List<T> list = new ArrayList<T>();
for (int i = 0; i < n; i++) {
    final T element = elements[i];
    if (element == null) {
        continue;
    } else {
        list.add(element);
...
int[][]removeDuplicatesInPath(int[][] path)
remove Duplicates In Path
if (path.length <= 2)
    return path;
int[][] newPath = new int[path.length][];
int index = 0;
newPath[0] = path[0];
for (int i = 1; i < path.length - 1; ++i) {
    if (isCollinear(path[i][0], path[i][1], path[i + 1][0], path[i + 1][1], newPath[index][0],
            newPath[index][1])) {
...
String[]removeDuplicateStrings(String[] array)
remove Duplicate Strings
if (isEmpty(array)) {
    return array;
Set<String> set = new TreeSet<String>();
for (String element : array) {
    set.add(element);
return toStringArray(set);
...
double[]removeDuplicateValues(double[] values)
remove Duplicate 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);
...