justinbriggs1 0 Posted October 27, 2010 Report 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. Quote Link to post Share on other sites
Synook 47 Posted October 28, 2010 Report 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? Quote Link to post Share on other sites
trinistorm 18 Posted October 29, 2010 Report 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.