ArrayLists

Go down

ArrayLists

Post by Paul on Wed Dec 09, 2009 12:10 am

Have ArrayLists in Java simplified your life in any way?
Have they helped you code something you couldn't code in C++?
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Admin on Wed Dec 09, 2009 1:14 am

no
avatar
Admin
Pirate King

Posts : 559

Back to top Go down

Re: ArrayLists

Post by Paul on Wed Dec 09, 2009 1:15 am

Admin wrote:no
Do you even know how to use ArrayLists, Allen?
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Admin on Wed Dec 09, 2009 1:16 am

if they're the same as arrays then yes i do, if not then no

else goto 4chan
avatar
Admin
Pirate King

Posts : 559

Back to top Go down

Re: ArrayLists

Post by Paul on Wed Dec 09, 2009 1:18 am

Admin wrote:if they're the same as arrays then yes i do, if not then no

else goto 4chan

They're not the same as arrays.
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Unchained on Wed Dec 09, 2009 2:48 am

I played with them for like a day then got bored.
avatar
Unchained
Mod

Posts : 448

Back to top Go down

Re: ArrayLists

Post by Paul on Wed Dec 09, 2009 3:21 am

They are an interesting feature to the language. They are very useful under some conditions.

esp. Anytime you need an array of undefined size or changing size.

They also have some search methods implemented.
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Unchained on Thu Dec 10, 2009 10:42 am

I thought Java had dynamic arrays without using array lists...
avatar
Unchained
Mod

Posts : 448

Back to top Go down

Re: ArrayLists

Post by Paul on Thu Dec 10, 2009 11:53 pm

Hmm. I don't think so, but I suppose it might be plausible. I doubt it because if so why would ArrayLists exist.
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Unchained on Fri Dec 18, 2009 4:54 am

Sorry for the late response, it was finals week.

Its my understanding that array lists are just to make arrays easier to use and organize, I could be wrong as well.
avatar
Unchained
Mod

Posts : 448

Back to top Go down

Re: ArrayLists

Post by Paul on Sat Dec 19, 2009 1:36 am

I think you are right. I used ArrayLists in my Java text adventure/rpg game.
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Unchained on Sat Dec 19, 2009 9:24 am

Good to know. I'm probably going to retake Java next semester so its always good to learn ahead of time. (I learned more on my own than from Blattner)
avatar
Unchained
Mod

Posts : 448

Back to top Go down

Re: ArrayLists

Post by Paul on Tue Dec 22, 2009 11:03 pm

So did I, at least so far. . .

I doubt he'll teach me more than I currently know though.
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Admin on Mon Feb 08, 2010 12:14 am

Ok now that I know about arraylists, my thoughts on it: BADASS.

have I used them before or will I ever use them? no, but it's nice to know others can use them and make better games for me.

_________________
avatar
Admin
Pirate King

Posts : 559

Back to top Go down

Re: ArrayLists

Post by Paul on Mon Feb 08, 2010 11:22 pm

Didn't I say so. . .

hmm, maybe I just thought it. . .
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Corey on Tue Feb 09, 2010 2:02 am

Hey, what exactly are they? I want to see if freebasic has them under a different name.

_________________
-Corey Hoard

(Yes, I totally copied Paul's avatar. Or, at least attempted to.)
avatar
Corey
Mod

Posts : 462

Back to top Go down

Re: ArrayLists

Post by Admin on Tue Feb 09, 2010 2:19 am

arrays that hold all standard datatypes.

_________________
avatar
Admin
Pirate King

Posts : 559

Back to top Go down

Re: ArrayLists

Post by Unchained on Tue Feb 09, 2010 6:36 am

Its my understanding that they also allow you to change them more easily.
avatar
Unchained
Mod

Posts : 448

Back to top Go down

Re: ArrayLists

Post by Admin on Tue Feb 09, 2010 6:45 am

oh yeah, you can change the size of the array and screw around with it a lot more than you could with a regular array. But you also have to include the arraylist library.

import Java.util.ArrayList; or something like that.

_________________
avatar
Admin
Pirate King

Posts : 559

Back to top Go down

Re: ArrayLists

Post by Paul on Tue Feb 09, 2010 11:51 pm

Code:
import java.util.ArrayList;

Basically, I would call it a wrapper class for arrays.

They can hold multiple data types and they have many useful functions already implemented for you.

Oh yeah, They also have a behavior defined for output. So instead of having to step through an array and output each element stored in the array, you can just output the ArrayList.

Code:

ArrayList list = new ArrayList();
System.out.println(list);
instead of:
Code:

int[] list = new int[10];
for(int i = 0; i < list.length(); i++)
{
    System.out.print(list[i] + ", ");
}


Last edited by Paul on Tue Feb 09, 2010 11:52 pm; edited 1 time in total (Reason for editing : thought of the word)
avatar
Paul
Pickaxe

Posts : 611

Back to top Go down

Re: ArrayLists

Post by Corey on Wed Feb 10, 2010 2:02 am

oh, interesting. If fb doesn't have it, I'll have to make an include for one.

_________________
-Corey Hoard

(Yes, I totally copied Paul's avatar. Or, at least attempted to.)
avatar
Corey
Mod

Posts : 462

Back to top Go down

Re: ArrayLists

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum