find index number of an Object in an ArrayList

hi guys

I have an array list of of products which contains 8 strings.

say productList[0]= "asaaas1212"

now i want to get a method which can find out at what index the string "asaaas1212"

is situated on the productList.

thanks

Message was edited by:

sifatkhan

[308 byte] By [sifatkhana] at [2007-11-27 5:07:08]
# 1
use indexOf("STRING") methodMessage was edited by: New_Kid
New_Kida at 2007-7-12 10:26:08 > top of Java-index,Java Essentials,Java Programming...
# 2
Yikes... Wat I said is for a ArrayListU r using a array.. for that use a simple loop
New_Kida at 2007-7-12 10:26:08 > top of Java-index,Java Essentials,Java Programming...
# 3
thanks for your replywill it work if i try thisint count= productList.indexOf("string")?cheerz
sifatkhana at 2007-7-12 10:26:08 > top of Java-index,Java Essentials,Java Programming...
# 4

> thanks for your reply

>

> will it work if i try this

>

> int count= productList.indexOf("string")?

>

> cheerz

yep.. If it doesn't.. blame SUN..

Lots of knowledge available here http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html

New_Kida at 2007-7-12 10:26:08 > top of Java-index,Java Essentials,Java Programming...
# 5
thanks mate
sifatkhana at 2007-7-12 10:26:08 > top of Java-index,Java Essentials,Java Programming...