I have two arrays "tags" and "selected" the tags array is static and depending on what the user selects the "select" array values will be set to true or false.
I want to compare the tags array and the select array and the "select" array positions that have true I want to pull out the correspoding position of the "tags" array and bulid a new array.
private String[] tags = new String[] { "Bob", "Tom", "Mike", "Smith" };
private boolean[] selected = new boolean[tags.length];
public String[] selected_tags;
for (int i = 0; i < tags.length; i++) {
if (selected[i] == true){
selected_tags[i] = tags[i];
}
I am not sure if I am doing this correctly because I feel like I would have empty spots in my selected_tag array. If there is a better way of doing this I am open to suggestions.
thanks!