Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

Commit cad70b9

Browse files
committed
Implement new methods in AccountAnalytics.java
1 parent b9baf56 commit cad70b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

account-analytics/src/main/java/com.bobocode/AccountAnalytics.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ public Map<Long, Account> collectAccountsById() {
154154
* @return map of account by its ids the were created in a particular year
155155
*/
156156
public Map<String, BigDecimal> collectBalancesByIdForAccountsCreatedOn(int year) {
157-
throw new UnsupportedOperationException("It's your job to implement this method"); // todo
157+
return accounts.stream()
158+
.filter(account -> account.getCreationDate().getYear() == year)
159+
.collect(toMap(Account::getEmail, Account::getBalance));
158160
}
159161

160162
/**

0 commit comments

Comments
 (0)