Did you read the documentation?
Rajiv Yelkawar wrote:
// comment on output: In this list index of "World" is 1 but out put is different.
The first time that you search the list you haven't sorted it yet at all so of course the search is going to give screwey results.
Rajiv Yelkawar wrote:
// comment on output: If reverseSort is used the output after reverse is length of arrarylist
The second time you search you're doing it after sorting the list backwards so again, the search will fail.
The list needs to be sorted with in
INCREASING order for the search to work.