|
@@ -2,18 +2,33 @@ package rocks.zipcode.quiz5.collections;
|
2
|
2
|
|
3
|
3
|
import rocks.zipcode.quiz5.objectorientation.account.BankAccount;
|
4
|
4
|
|
|
5
|
+import java.util.ArrayList;
|
|
6
|
+import java.util.List;
|
|
7
|
+
|
5
|
8
|
/**
|
6
|
9
|
* @author leon on 27/12/2018.
|
7
|
10
|
*/
|
8
|
11
|
public class Bank {
|
|
12
|
+
|
|
13
|
+ private List<BankAccount> accounts;
|
|
14
|
+
|
|
15
|
+ public Bank() {
|
|
16
|
+ this.accounts = new ArrayList<>();
|
|
17
|
+ }
|
|
18
|
+
|
9
|
19
|
public BankAccount removeBankAccountByIndex(Integer indexNumber) {
|
10
|
|
- return null;
|
|
20
|
+ BankAccount bankAccount = accounts.get(indexNumber);
|
|
21
|
+ accounts.remove(bankAccount);
|
|
22
|
+
|
|
23
|
+ return bankAccount;
|
11
|
24
|
}
|
12
|
25
|
|
13
|
26
|
public void addBankAccount(BankAccount bankAccount) {
|
|
27
|
+ accounts.add(bankAccount);
|
14
|
28
|
}
|
15
|
29
|
|
16
|
30
|
public Boolean containsBankAccount(BankAccount bankAccount) {
|
17
|
|
- throw new UnsupportedOperationException("Method not yet implemented");
|
|
31
|
+ return accounts.contains(bankAccount);
|
|
32
|
+ // throw new UnsupportedOperationException("Method not yet implemented");
|
18
|
33
|
}
|
19
|
34
|
}
|