Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
UniquePersonList: check for null arguments more thoroughly
Browse files Browse the repository at this point in the history
Some methods do not explicitly check that their arguments are non-null
with `requireNonNull(...)`.

Let's fix them to be consistent with the rest of the code base.
  • Loading branch information
pyokagan committed Aug 9, 2018
1 parent bc1b068 commit e747390
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void add(Person toAdd) {
* The person identity of {@code editedPerson} must not be the same as another existing person in the list.
*/
public void setPerson(Person target, Person editedPerson) {
requireNonNull(editedPerson);
requireAllNonNull(target, editedPerson);

int index = internalList.indexOf(target);
if (index == -1) {
Expand All @@ -78,6 +78,7 @@ public void remove(Person toRemove) {
}

public void setPersons(UniquePersonList replacement) {
requireNonNull(replacement);
this.internalList.setAll(replacement.internalList);
}

Expand Down

0 comments on commit e747390

Please sign in to comment.