package ru.matevosyan.lesson_5_Array;

public class DeleteDuplicate{

	public String[] searchDuplicate (String mas[]) {
		

		for (int k = 0; k < mas.length - 1; k++) {

						
			for (int i = k + 1; i < mas.length; i++) {
			
				if (mas[k].equals(mas[i])) {
				
					mas[i] = "null";
		
				}
														
			}

		}

	return mas;

	}

}
@@ -30,16 +30,36 @@
 5_Array;
+%0Aimport java.lang.*;
 %0A%0Apublic
@@ -104,14 +104,17 @@
 g%5B%5D 
-search
+deleteArr
 Dupl
@@ -138,16 +138,108 @@
 %5B%5D) %7B%0A%09%09
+%0A%09%09//copy uniqe elements%0A%0A%09%09int counter = 0;%0A%0A%09%09String%5B%5D copyArray = new String%5Bmas.length%5D;
 %0A%0A%09%09for 
@@ -247,16 +247,16 @@
 int 
-k
+i
  = 0; 
-k
+i
  %3C m
@@ -268,15 +268,11 @@
 ngth
- - 1
 ; 
-k
+i
 ++) 
@@ -282,41 +282,277 @@
 %09%09%09%09
+%0A
 %09%09
-%0A%09%09%09for (int i = k + 1; i %3C mas
+%09if (!(containsStringinArray(copyArray, mas%5Bi%5D))) %7B%0A%09%09%09%09%09%0A%09%09%09%09copyArray%5Bi%5D = mas%5Bi%5D;%0A%09%09%09%09%0A%09%09%09%09counter++;%0A%0A%09%09%09%7D%0A%0A%09%09%7D%0A%09%09%0A%09%09//delete duplicate elements%0A%0A%09%09String%5B%5D uniqeStringArray = new String%5Bcounter%5D;%0A%0A%09%09int uniqeArrayPosition = 0;%0A%09%09%0A%09%09for (int k = 0; k %3C copyArray
 .len
@@ -560,17 +560,17 @@
 th; 
-i
+k
 ++) %7B%0A%09%09
 %09%0A%09%09
@@ -569,113 +569,407 @@
 %7B%0A%09%09
-%09%0A%09
+%0A
 %09%09%09if (
-mas%5Bk%5D.equals(mas%5Bi%5D)) %7B%0A%09%09%09%09
+copyArray%5Bk%5D != null) %7B%0A%09%09%09%0A%09%09%09%09uniqeStringArray%5BuniqeArrayPosition%5D = copyArray%5Bk%5D;%0A%09%09%09%09%0A%09%09%09%09uniqeArrayPosition++;%0A%09%09%09%7D%0A%09%09%0A%09%09%7D%0A%09%09%0A%09return uniqeStringArray;%0A%09%0A%09%7D%0A%0A%09public boolean containsStringinArray (String%5B%5D arr, String x)%7B%0A%09%09%09%0A%09%09%09for (int i = 0; i %3C arr.length; i++) %7B
 %0A%09%09%09
+%0A
 %09%09
-mas%5Bi%5D = %22null%22;%0A%09%09%0A
+%09%09if(arr%5Bi%5D!=null)%7B%0A%0A%09%09%09%09%09if (arr%5Bi%5D==x) %7B%0A%09
 %09%09%09%09
-%7D
 %0A%09%09%09%09%09%09
+return true;%0A
 %09%09%09%09%09
+%0A%09
 %09%09%09
+%09%7D
 %0A%09%09%09
-%7D%0A%0A
+%09%0A%09%09%09%09%7D%0A%09%09%09%09%0A%09
 %09%09%7D%0A%0A
+%09
 %09return 
 mas;
@@ -968,14 +968,20 @@
 urn 
-mas;%0A%0A
+false;%0A%09%09%09%0A%09
 %09%7D%0A%0A

add DeleteDuplicate.java