I'm really hoping I can convey my intentions here:
I have a class called ("Branch") (I believe it is called an Object) and I have 2 instances of branches.
Basically (in my main class):
private static Branch branch1 = new Branch();
private static Branch branch2 = new Branch();
I know how to (on a basic level) add to a branch and how to remove from branch1.
(in my Branch class file):
public void addPet(VirtualPet pet) {
pets.add(pet);
}
public void removePet(String name) {
for (int i = 0; i < pets.size(); i++) {
if (pets.get(i).getName().equals(name)) {
pets.remove(i);
}
}
}
These work fine. But I'm trying to do a transfer from 1 branch to another branch (ex: branch1 to branch2).
I figure my removePet method would be the same, but I'm wondering how do I add that pet to the other branch? I know how to add a completely new pet, but I'm not sure how to pull the data from the pet I'm deleting and use that to add the new pet.