-
String comparison
Hi
I m developing an application in which i want to compare a String with string[].
Means i m having array of names which i m displaying in a table..Then i m changing some names in table dynamically by some processing and adding new names to the table...
While replacing i want to check weather the new name is present in the array of previously added names... and if not present add it to table...
Now if i used for loop and compare new name with names[] ..it'll compare only one name at a time..but i want to compare new name with total array...
how can i do this..
plz help..
thnks..
-
Unless I am mistaken, you wont be able to do this with an array unless you use the for loop method. Try using a List<String>. That will allow you to do a little more. Also look into HashMap. One of these should lead you to a solution.
-
Yes, use a List. Because it not support for duplicate also. So you can simply identify there is String already included, which you are going to add.