[android-developers] Re: need some collection help

2009-03-27 Thread Mark Murphy
Josh Dobbs wrote: Here's what my code looks like... * private * Collection __cars_; Car _myCar_= *new* Car(1,1,*false*,5, blue); Car _myCar2_= *new* Car(1,1,*false*,5, red); _cars.add(myCar); _cars.add(myCar2); Collection is an interface, not a class. There are about 20

[android-developers] Re: need some collection help

2009-03-27 Thread Streets Of Boston
You can not create a Collection. It is an interface, as other already pointed out. Judging from your other posts, i'd suggest your using an ArrayListCar. An ArrayList is basically some behavior around an array of objects (in your case Car[]). Internally, it's using an array and it handles all

[android-developers] Re: need some collection help

2009-03-27 Thread Josh Dobbs
Thanks for the clear explanation. This is exactly what i needed! On Fri, Mar 27, 2009 at 6:57 AM, Streets Of Boston flyingdutc...@gmail.comwrote: You can not create a Collection. It is an interface, as other already pointed out. Judging from your other posts, i'd suggest your using an

[android-developers] Re: need some collection help

2009-03-26 Thread Mark Murphy
Josh wrote: I want to store objects into an array or collection(whichever is best suited to this in dalvik). You mean like the ones in the java.util package? the objects are basically just VO's all of the same class that i want to keep track of. What's a VO? -- Mark Murphy (a Commons

[android-developers] Re: need some collection help

2009-03-26 Thread Josh Dobbs
You mean like the ones in the java.util Yes, specifically java.util.collection What's a VO? A VO is basically a class that only contains properties(Value Objects). On Thu, Mar 26, 2009 at 4:53 AM, Mark Murphy mmur...@commonsware.comwrote: Josh wrote: I want to store objects into an array

[android-developers] Re: need some collection help

2009-03-26 Thread Josh Dobbs
Here's what my code looks like... * private* Collection *_cars*; Car *myCar*= *new* Car(1,1,*false*,5, blue); Car *myCar2*= *new* Car(1,1,*false*,5, red); _cars.add(myCar); _cars.add(myCar2); On Thu, Mar 26, 2009 at 6:18 AM, Josh Dobbs joshdo...@gmail.com wrote: You mean like the ones in

[android-developers] Re: need some collection help

2009-03-26 Thread Stoyan Damov
I don't understand what are you really asking? Whether arrays are faster than collection classes? Yes, they are faster, but you have to manage their contents (insertions, deletions, etc.) yourself. On Thu, Mar 26, 2009 at 3:31 PM, Josh Dobbs joshdo...@gmail.com wrote: Here's what my code looks

[android-developers] Re: need some collection help

2009-03-26 Thread Josh Dobbs
I want to keep track of multiple instances of a class without hardcoding a bunch of variables. I can use either an array or collection it doesnt really matter to me but I cant seem to get either to work. I cant seem to find an example of what I want to do anywhere. Im also open to suggestions if

[android-developers] Re: need some collection help

2009-03-26 Thread Josh Dobbs
also the reason i ldidnt use array is because i couldnt figure out how to add objects to it. there is no add method:(. On Thu, Mar 26, 2009 at 6:50 PM, Josh Dobbs joshdo...@gmail.com wrote: I want to keep track of multiple instances of a class without hardcoding a bunch of variables. I can