Commit 4d86c2b4 authored by Jan Tattermusch's avatar Jan Tattermusch

fixed java example

parent b95670f5
......@@ -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));
......
......@@ -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 #: ");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment