I have an ArrayList which is filled in with multiple Strings. However,when I use the 'contains' method to search if a given string exists in the arraylist,I do not get the desired result. Why is it so - i thought the 'contains' method uses 'equals' to compare by value.
Looking at the source code for ArrayList, I see that it does indeed use equals(). Therefore the reason you dont get the expected result must reside in your code.