How to implement this? please help
In my java class, I have a string array calledstrarray which hold serveral elements, some of the elements have the same value , for example, the first element is "swimming", the forth element is also swimming. I use a for loop to get each element and give it toarrayHolder which is also a array with the same size asstrarray. Now, what I want is: I defined a Vector calledelement I want this vector to filter out the element fromarrayHolder, get the name of non-duplicated name from the arrayHolder, the result should be inside the element vector (swimming,walking,running,dancing), no duplicated name. My code is like follows:
_
import java.util.*;
import java.io.*;
public class arrayTest{
public static void main(String arg[]){
String[] strarray={"swimming","running","walking","swimming","dancing","running"};
String[] arrayHolder=new String[strarray.size];
Vector element=new Vector();
for(int i=0;i<strarray.length();i++){
arrayHolder[ i ]=strarray[ i ];
/* What should I do next to get the non-duplicated element from arrayHolder and
* add them into the element vector?
*/
}
}
}
I did not finnish it, since I am a little bit confused, how to implement? Need some help. thanks.
Message was edited by:
Mellon>

