ArrayLists
4 posters
CMPC :: Computing :: Programming :: Java
Page 1 of 1
ArrayLists
Have ArrayLists in Java simplified your life in any way?
Have they helped you code something you couldn't code in C++?
Have they helped you code something you couldn't code in C++?
Paul- Pickaxe
- Posts : 611
Re: ArrayLists
if they're the same as arrays then yes i do, if not then no
else goto 4chan
else goto 4chan
Admin- Pirate King
- Posts : 559
Re: ArrayLists
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- Pickaxe
- Posts : 611
Re: ArrayLists
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.
esp. Anytime you need an array of undefined size or changing size.
They also have some search methods implemented.
Paul- Pickaxe
- Posts : 611
Re: ArrayLists
Hmm. I don't think so, but I suppose it might be plausible. I doubt it because if so why would ArrayLists exist.
Paul- Pickaxe
- Posts : 611
Re: ArrayLists
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.
Its my understanding that array lists are just to make arrays easier to use and organize, I could be wrong as well.
Unchained- Mod
- Posts : 448
Re: ArrayLists
I think you are right. I used ArrayLists in my Java text adventure/rpg game.
Paul- Pickaxe
- Posts : 611
Re: ArrayLists
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- Mod
- Posts : 448
Re: ArrayLists
So did I, at least so far. . .
I doubt he'll teach me more than I currently know though.
I doubt he'll teach me more than I currently know though.
Paul- Pickaxe
- Posts : 611
Re: ArrayLists
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.
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- Pirate King
- Posts : 559
Re: ArrayLists
Hey, what exactly are they? I want to see if freebasic has them under a different name.
Corey- Mod
- Posts : 462
Re: ArrayLists
Its my understanding that they also allow you to change them more easily.
Unchained- Mod
- Posts : 448
Re: ArrayLists
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.
import Java.util.ArrayList; or something like that.
Admin- Pirate King
- Posts : 559
Re: ArrayLists
- 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);
- 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- Pickaxe
- Posts : 611
Re: ArrayLists
oh, interesting. If fb doesn't have it, I'll have to make an include for one.
Corey- Mod
- Posts : 462
CMPC :: Computing :: Programming :: Java
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|