justinbriggs1 Posted October 27, 2010 Share Posted October 27, 2010 Hey everyone, I am messing around with the arrayList class, and I am having a bit of trouble.arrayList utilizes an object buffer to keep track of the class elements. How do I extract the last variable from the buffer? This is obviously pretty easy if it is cast to an array, but I can't figure it out with an object.Also, is there a way to extract an object variable at a specified index?Thanks, really confused, any help would be appreciated. Link to comment Share on other sites More sharing options...
Synook Posted October 28, 2010 Share Posted October 28, 2010 The ArrayList instance should make methods available to access that functionality. For example, you could use ArrayList.get() in conjunction with ArrayList.size(). Also, is there a way to extract an object variable at a specified index?What do you mean? Link to comment Share on other sites More sharing options...
trinistorm Posted October 29, 2010 Share Posted October 29, 2010 What he wants I presume is the object returned from the get method. The indexof(Obj elm) method will get you the location of the elm where elm is an Object you create and pass to it. Use the return value of this method as input into the ArrayList.get method and you will get the Object you want returned from there. You can use methods on Object like 'tostring' to convert an Object to something usefull. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.