fixed java example

This commit is contained in:
Jan Tattermusch 2015-07-20 14:51:09 -07:00
parent b95670f5fb
commit 4d86c2b495
2 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ class AddPerson {
stdout.println("Unknown phone type. Using default.");
}
person.addPhone(phoneNumber);
person.addPhones(phoneNumber);
}
return person.build();
@ -80,7 +80,7 @@ class AddPerson {
}
// Add an address.
addressBook.addPerson(
addressBook.addPersons(
PromptForAddress(new BufferedReader(new InputStreamReader(System.in)),
System.out));

View File

@ -9,14 +9,14 @@ import java.io.PrintStream;
class ListPeople {
// Iterates though all people in the AddressBook and prints info about them.
static void Print(AddressBook addressBook) {
for (Person person: addressBook.getPersonList()) {
for (Person person: addressBook.getPersonsList()) {
System.out.println("Person ID: " + person.getId());
System.out.println(" Name: " + person.getName());
if (person.hasEmail()) {
if (!person.getEmail().isEmpty()) {
System.out.println(" E-mail address: " + person.getEmail());
}
for (Person.PhoneNumber phoneNumber : person.getPhoneList()) {
for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {
switch (phoneNumber.getType()) {
case MOBILE:
System.out.print(" Mobile phone #: ");