Last active
August 29, 2015 14:07
-
-
Save dano1234/ac97879f37f290720b1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Array way is commented out. ArrayList way is not. | |
DECLARE | |
ArrayList<Baby> manyBabyHolder; | |
//Baby[ ] manyBabyHolder; | |
CREATE | |
manyBabyHolder = new ArrayList<Baby>(); | |
//manyBabyHolder = new Baby[1000]; | |
ADD TO | |
manyBabyHolder.add(new Baby(int(random(width)), int( random(height)))); //birth | |
// manyBabyHolder[placeToAddInArray] = new Baby(int(random(width)), int( random(height))); //birth | |
// placeToAddInArray++; | |
ITERATE THROUGH | |
for (int i =0; i < manyBabyHolder.size (); i++) { | |
Baby thisBaby = manyBabyHolder.get(i); | |
//for (int i =0; i < manyBabyHolder.length; i++) { | |
// Baby thisBaby = manyBabyHolder[i]; | |
// if (thisBaby != null) { //check to see if you put something in this part of the array | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment