Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
4d86c2b4
Commit
4d86c2b4
authored
Jul 20, 2015
by
Jan Tattermusch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed java example
parent
b95670f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
AddPerson.java
examples/AddPerson.java
+2
-2
ListPeople.java
examples/ListPeople.java
+3
-3
No files found.
examples/AddPerson.java
View file @
4d86c2b4
...
...
@@ -50,7 +50,7 @@ class AddPerson {
stdout
.
println
(
"Unknown phone type. Using default."
);
}
person
.
addPhone
(
phoneNumber
);
person
.
addPhone
s
(
phoneNumber
);
}
return
person
.
build
();
...
...
@@ -80,7 +80,7 @@ class AddPerson {
}
// Add an address.
addressBook
.
addPerson
(
addressBook
.
addPerson
s
(
PromptForAddress
(
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
)),
System
.
out
));
...
...
examples/ListPeople.java
View file @
4d86c2b4
...
...
@@ -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
.
getPerson
s
List
())
{
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
.
getPhone
s
List
())
{
switch
(
phoneNumber
.
getType
())
{
case
MOBILE:
System
.
out
.
print
(
" Mobile phone #: "
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment