New to programming, please forgive if this is stupid
I'm trying to loop through two arrayLists at once in Java. Below is my code and beneath that is the code I am trying to implement (if this is possible).
In a class "Tournament", it creates and stores Champion objects. I have two arrayLists: championList(this stores all hard coded champion objects into the game) and teamList(champion objects are added to a players team).
I want to check if the champion object in question (the parameter in the method) exists by looping through both arrayLists and returning a specified int if it doesn't.
Working code:
public int retireChamp(String nme){
for(Champion temp: championList)
{
if(temp.getName().equals(nme))
do something etc...
}
Code I want to implement if possible
public int retireChamp(nme){
for(Champion temp: championList && teamList)
{
do something...
}