-
December 5th, 2011, 02:18 AM
#1
[RESOLVED] Java Collections
Can anyone help me with teh below mentioned programming problem:
Assume you are writing an application working with Person objects. The application uses Person objects in Collections, placing them into Collection implementations and querying if a Person is in a Collection using the Collection.contains() method. The application also uses Person objects as keys in Maps to associate other objects with Persons and to efficiently look up those objects based on Person. Given these needs, will the following Person implementation work in our application? If not, please fix it so that it will.
public class Person {
private String firstName;
private String lastName;
private Date dob;
/** Construct a Person given the first name, last name, and birth date. */
public Person(String firstName, String lastName, Date dob) {
if (firstName == null || lastName == null || dob == null) {
throw new IllegalArgumentException();
}
this.firstName = firstName;
this.lastName = lastName;
this.dob = dob;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|