Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: help with a if statement
|
Posted: Dec 19, 2002 5:31 PM
|
|
It isn't very clear what you are trying to do, but you might replace the 1 with ((Integer)arraylist.get(arraylist.size()-1)).intValue()
if you want to use the last value added to the ArrayList (if that is the case, you may want to look at using a LinkedList, by the way).
By the way, why are you using the old contructs like Hashtables and Enumerations instead of using the easier-to-use new APIs, such as Iterator and Map? Also, why hard-code the datatype into the name (arraylist)? In any case, why not just use a List, which might be an ArrayList, or some other type of List, like a LinkedList? I generally prefer to create my lists and maps and other things like this:
List kingPawnOpenings = new ArrayList();
Map commonPositions = new HashMap();
Then at some later time, if I decide I'd rather be using a LinkedList or TreeMap, making the change is simpler.
Also, it looks like you are just experimenting now, but when you start writing some real production code, it is a good idea to use more descriptive variable names than "it" and "it2."
|
|