findDeck method
- String deckName
Procura um deck na lista de decks e retorna o index, se não existir então a posição -1 é retornada
Implementation
int findDeck(String deckName) {
int index = -1;
int tam = this.decks.length;
bool found = false;
if (tam > 0) {
// Varre a lista procurando alguém com o mesmo nome
while (index < tam - 1 && !found) {
index++;
if (this.decks[index].getName() == deckName) found = true;
}
}
// Se saiu do loop, mas não achou então muda pra o index pra -1
if (!found) {
index = -1;
}
return index;
}