ListArray Help

Hello everyone,

If I have the method:

public Cars findByNumber(String carNumber){

private ListArray<Object> car = new ListArray<Object>();

Now If I convert the String into an Integer:

Integer carnum = new Integer(carNumber);

-- and someone passes letters instead of numbers in the string, I cannot upcast:

Cars whatcar = (Cars)car.get(carnum);

That will come out with an error if the string is anything other than numbers (integers). Is there another way to get a list arrays object other than with an int value, instead a string?

[598 byte] By [ryancca] at [2007-11-26 18:42:00]
# 1
Do you mean ArrayList?
litesouta at 2007-7-9 6:16:00 > top of Java-index,Java Essentials,Java Programming...
# 2
It's ArrayList, actually.There is an equivalent that will take non-numeric strings, a Map. Use HashMap if you don't care about order and TreeMap if you do.
malcolmmca at 2007-7-9 6:16:00 > top of Java-index,Java Essentials,Java Programming...