I have an ArrayList
of type String
. I want to determine whether any element of this ArrayList
starts with a specified string and if the ArrayList
contains this element, then I want to get the index of this element. In addition, I do not want to loop this ArrayList
to get the index of that element.
For example :
ArrayList<String> asd = new ArrayList<String>(); // We have an array list
//We filled the array list
asd.add("abcc trtiou");
asd.add("aiwr hiut qwe");
asd.add("vkl: gtr");
asd.add("aAgiur gfjhg ewru");
Now, I want to get the index of the element vkl: gtr
by using vkl:
without looping array list.(searching also should be case insensitive, so, using vkl:
and VkL:
should give the index of vkl: gtr
)
How can I do this ?
Thanks in advance.