mirror of
https://github.com/hmalik144/Android-Cucumber-BDD-Sample.git
synced 2025-12-09 23:45:19 +00:00
Moved the Calendar allocation outside the for loop.
This commit is contained in:
@@ -67,10 +67,10 @@ public class Library {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user