Boa noite.
Estou com um problema em um exercício da faculdade, eu simplesmente não consigo de jeito nenhum fazer o programa imprimir uma coleção com o Interator, é como se não ouvesse o Sysout ou a coleção, não consigo achar o erro no programa.
Segue o código da Classe de Controle: (se necessário eu posto o projeto inteiro com as Classes de Domínio)
public class Programa {
public static void main(String[] args) {
Scanner leia = new Scanner(System.in);
System.out.println("CADASTRO DE CLIENTES");
System.out.print("Digite o CPF: ");
String cpf = leia.nextLine();
System.out.print("Digite o nome: ");
String nome = leia.nextLine();
System.out.print("Digite o endereço: ");
String end = leia.nextLine();
System.out.print("Digite o telefone: ");
String tel = leia.nextLine();
Cliente cli = new Cliente(cpf, nome, end, tel);
System.out.println("\nCADASTRO DE ANIMAIS");
ArrayList<Animal> listaPets = new ArrayList<Animal>();
char resposta = 'S';
do {
System.out.print("Digite o nome: ");
String nomeA = leia.next();
System.out.print("Digite a espécie: ");
String espec = leia.next();
System.out.print("Digite a raça: ");
String raca = leia.next();
System.out.print("Digite o ano de nascimento: ");
int anoNasc = leia.nextInt();
System.out.print("Digite o sexo: ");
char sexo = leia.next().charAt(0);
Animal pet = new Animal(nomeA, espec, raca, anoNasc, sexo);
cli.addAnimal(pet);
System.out.print("Deseja Continuar? <S/N>: ");
resposta = leia.next().charAt(0);
} while (resposta == 's');
System.out.println("Lista de Pets do(a) Cliente " + cli.getNome());
Iterator<Animal> it = listaPets.iterator();
while (it.hasNext()) {
Animal pet = it.next();
System.out
.println(pet.getNome() + pet.getEspecie() + pet.getRaca() + pet.getAnoNascimento() + pet.getSexo());
}
}
}
Desde já, obrigado.