I have an arraylist at the start of my class
private ArrayList<Dog> dogs;
This is how dog is declared in the dog class
public Dog(String name, ArrayList<Owner> owners, boolean likeBones, String food,
int mealsPerDay);
I am trying to find the dogs who like bones and save that dog into result. The rest of the code works fine including .getLikesBones().
Dog[] result = null;
for (Dog dogSearch : dogs) {
if (dogSearch.getLikesBones()){
result =dogSearch; //I know this won't work, just simply showing what I want.
}
}
return result;
}
thank you in advance for all help.