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>

[1384 byte] By [Mellona] at [2007-11-27 0:45:41]
# 1

Not sure if I see the use of strArray & arrayHolder (I've not looked at your code - you might use code tags next time (check the "code" button above the message textarea), but may I suggest using a Map of some sort instead of a Vector?It will prevent duplicates for you.

Good Luck

lee

tsitha at 2007-7-11 23:11:07 > top of Java-index,Java Essentials,Java Programming...
# 2
ok, ill start on it right away.please provide your full name, and the name of the course, name of the professor so i may put it in header comments.i think i should be able to do it in under an hour, please respond fast
mkoryaka at 2007-7-11 23:11:07 > top of Java-index,Java Essentials,Java Programming...