-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathExercise1.java
More file actions
51 lines (41 loc) · 945 Bytes
/
Exercise1.java
File metadata and controls
51 lines (41 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.elsevier.education;
import java.util.Set;
/**
TODO: Make this class immutable.
*/
public class Exercise1 {
/**
* the class must be set to final so it can not be extended.
*/
public static final class Person {
/**
* all members must be set to final.
*/
private final Set<String> phoneNumbers;
private final String firstName;
private final String lastName;
/**
* constructor must take all args so that they can be set.
* @param phoneNumbers
* @param firstName
* @param lastName
*/
public Person(Set<String> phoneNumbers,String firstName, String lastName) {
this.phoneNumbers = phoneNumbers;
this.firstName = firstName;
this.lastName = lastName;
}
/**
* all setters removed.
*/
public Set<String> getPhoneNumbers() {
return phoneNumbers;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
}
}