I leave you an exercise in which I am in charge of comparing all the elements and the repeated ones equal to cadena vacía ""
in such a way that the impression is like the one you ask for. The access to the file and replace it is already yours.
Example:
public class ElementosRepetidosTest {
public static void main(String[] args) {
String[] numsEjemplo = {"1323", "7445", "1323", "5345", "3455", "1323"};
for (int todo = 0; todo < numsEjemplo.length; todo++) {
for (int i = 0; i < numsEjemplo.length; i++) {
if(i != todo){
if(numsEjemplo[todo].equals(numsEjemplo[i])){
numsEjemplo[todo] = "";
}
}
}
}
imprimeArray(numsEjemplo);
}
public static void imprimeArray(String[] array){
for (String elem : array) {
if (!elem.equals(""))
System.out.println(elem);
}
}
}
Result:
It is comparing in the respective loops all the positions of our arrangement with each one of the elements except those that are in their same position, that is, saved by itself. And in the case that they have the same value or string in this case, we equate to empty string always the one that is in a previous index.
Greetings and I hope you have understood. ;)