I have a string arraylist
. Need to get the index values of all elements if its value equals a specific character.
For eg need to get the index value of element if its value = "."
with indexOf()
& lastIndexOf()
i am able to find only the index value of 1st and last occurrence respectively.
ArrayList<String> als_data = new ArrayList<String>();
als_data[0] = "a"
als_data[1] = "b"
als_data[2] = "a"
als_data[3] = "c"
als_data[4] = "d"
als_data[5] = "a"
now i need to find the indices of "a"
my output should be like
0
2
5
please help me out in doing this.