Browse Source

pre-merge commit

Brandon Defrancis 5 years ago
parent
commit
b62f2c2f5d
1 changed files with 8 additions and 10 deletions
  1. 8
    10
      src/main/java/rocks/zipcode/quiz5/collections/Bank.java

+ 8
- 10
src/main/java/rocks/zipcode/quiz5/collections/Bank.java View File

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