java - how to get just one item from array of strings if the other is the same -
i want know if there function in java retrieve 1 string array of strings if other strings same i.e. if have in array : yes,yes,yes,yes,no,no,no,no .. want 1 yes , 1 no , display them! , not using loop , comparing ! , want know if function exists in java .
insert set.then u that
string[] array = {"yes","yes","yes","yes","no","no","no","no"}; set<string> myset = new hashset<string>(arrays.aslist(array));
set not allow duplicates.
finally set contains yes
, no
(only 2 elements)
Comments
Post a Comment