CMPC
Would you like to react to this message? Create an account in a few clicks or log in to continue.

ArrayLists

4 posters

Go down

ArrayLists Empty ArrayLists

Post by Paul 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++?
Paul
Paul
Pickaxe

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

no
Admin
Admin
Pirate King

Posts : 559

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

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

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Admin 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
Admin
Admin
Pirate King

Posts : 559

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Paul 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.
Paul
Paul
Pickaxe

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

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

Posts : 448

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Paul 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.
Paul
Paul
Pickaxe

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

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

Posts : 448

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Paul 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.
Paul
Paul
Pickaxe

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Unchained 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.
Unchained
Unchained
Mod

Posts : 448

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

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

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Unchained 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)
Unchained
Unchained
Mod

Posts : 448

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Paul 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.
Paul
Paul
Pickaxe

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Admin 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.
Admin
Admin
Pirate King

Posts : 559

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

Didn't I say so. . .

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

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Corey 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
Corey
Mod

Posts : 462

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

arrays that hold all standard datatypes.
Admin
Admin
Pirate King

Posts : 559

Back to top Go down

ArrayLists Empty Re: ArrayLists

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

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

Posts : 448

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Admin 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.
Admin
Admin
Pirate King

Posts : 559

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Paul 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)
Paul
Paul
Pickaxe

Posts : 611

Back to top Go down

ArrayLists Empty Re: ArrayLists

Post by Corey 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
Corey
Mod

Posts : 462

Back to top Go down

ArrayLists Empty 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