Haulien icon

Untitled

Haulien | PRO | 09/21/14 03:15:50 PM UTC | 0 ⭐ | 450 👁️ | Never ⏰ | []
text |

680 B

|

None

|

0 👍

/

0 👎

	public int addCreature(Creature newCreature) {
        // if the passed in creature creature doesn't exist, don't add it
        if ( newCreature == null )
        {
            return -1;
        }
         // if we already contain the creature, don't attempt to add it
        if (findCreature(newCreature.getName()) != null) {
            return -1;
        }
         // make some room
        increaseArray();
         // assume increaseArray() increases by one
        // and the new element is empty...
         // add the new creature to the list
        creatureList[creatureList.length-1] = newCreature;
        return creatureList.length-1;
	}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎