package ru.job4j.array;

import java.util.Arrays;
/**
 * Class ArrayDuplicate.
 *
 * @author Alexey Leishin (lepishin.ao@yandex.ru)
 * @version 1
 * @since 06.06.2017
 */
public class ArrayDuplicate {
	/**
	 * remove.
	 * @param array array.
	 * @return Arrays.
	 */
	public String[] remove(String[] array) {
		//String[] words = new String[array.length];
		String bufer = null;
		int count = array.length;
		for (int i = 0; i < count; i++) {
			for (int j = 0; j < array.length; j++) {
				if (j == i || j == count) {
					continue;
				}
				if (array[i].equals(array[j])) {
					count--;
					bufer = array[count];
					array[count] = array[j];
					array[j] = bufer;
				}
			}
		}
		return Arrays.copyOf(array, array.length - (count - 1));
	}
}
@@ -306,55 +306,8 @@
 ) %7B%0A
-%09%09//String%5B%5D words = new String%5Barray.length%5D;%0A
 %09%09St
@@ -584,24 +584,20 @@
 ount%5D = 
-array%5Bj%5D
+null
 ;%0A%09%09%09%09%09a
@@ -662,34 +662,13 @@
 ay, 
-array.length - (count - 1)
+count
 );%0A%09

task 225_4