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 addedWord = "";
		int count = 0;
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j <= i; j++) {
				if (array[i] == array[j]) {
					words[i] = array[j];
					//addedWord = words[count];
				}
			}
			count++;
		}
		return Arrays.copyOf(words, count);
	}
}
@@ -304,16 +304,18 @@
 ay) %7B%0A%09%09
+//
 String%5B%5D
@@ -362,22 +362,20 @@
 ing 
-addedWord = %22%22
+bufer = null
 ;%0A%09%09
@@ -386,17 +386,28 @@
 count = 
-0
+array.length
 ;%0A%09%09for 
@@ -422,28 +422,21 @@
  0; i %3C 
-array.length
+count
 ; i++) %7B
@@ -462,11 +462,21 @@
  j %3C
-= i
+ array.length
 ; j+
@@ -492,20 +492,77 @@
 if (
-array%5Bi%5D == 
+j == i %7C%7C j == count) %7B%0A%09%09%09%09%09continue;%0A%09%09%09%09%7D%0A%09%09%09%09if (array%5Bi%5D.equals(
 arra
@@ -566,24 +566,25 @@
 rray%5Bj%5D)
+)
  %7B%0A%09%09%09%09%09
 words%5Bi%5D
@@ -579,16 +579,27 @@
 %09%09%09%09
-words%5Bi%5D
+count--;%0A%09%09%09%09%09bufer
  = a
@@ -607,17 +607,21 @@
 ray%5B
-j
+count
 %5D;%0A%09%09%09%09%09
 //ad
@@ -620,98 +620,127 @@
 %09%09%09%09
-//addedWord = words%5Bcount%5D;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09count++;%0A%09%09%7D%0A%09%09return Arrays.copyOf(words, count
+array%5Bcount%5D = array%5Bj%5D;%0A%09%09%09%09%09array%5Bj%5D = bufer;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return Arrays.copyOf(array, array.length - (count - 1)
 );%0A%09

task 225_3