Skip to content

Commit

Permalink
Moved the Calendar allocation outside the for loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
Iiro Krankka committed Jan 9, 2017
1 parent a73693a commit 7150d9f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ private List<Book> findBooksByTitle(String titleQuery) {
}

private List<Book> findBooksByYear(String searchedYear) {
Calendar candidateCalendar = Calendar.getInstance();
List<Book> results = new ArrayList<>();

for (Book candidate : inventory) {
Calendar candidateCalendar = Calendar.getInstance();
candidateCalendar.setTime(candidate.getPublishDate());

int candidateYear = candidateCalendar.get(Calendar.YEAR);
Expand Down

0 comments on commit 7150d9f

Please sign in to comment.