package com.accenture.multibank.dao;

import java.util.HashMap;
import java.util.Map;

import com.accenture.multibank.accounts.AccountReadable;

public class HashMapAccountDAO implements AbstractDAO<Integer, AccountReadable> {

	private Map<Integer, AccountReadable> map = new HashMap<>();

	@Override
	public void save(AccountReadable account) {
		map.put(account.getAccountNumber(), account);
	}

	@Override
	public AccountReadable find(Integer accountNumber) {
		return map.get(accountNumber);
	}

	@Override
	public void update(AccountReadable account) {
		if (map.containsKey(account.getAccountNumber()))
			map.put(account.getAccountNumber(), account);
	}

	@Override
	public AccountReadable delete(Integer accountNumber) {
		return map.remove(accountNumber);
	}
}

@@ -123,28 +123,30 @@
 unts.Account
-Read
+Modifi
 able;%0A%0Apubli
@@ -206,28 +206,30 @@
 ger, Account
-Read
+Modifi
 able%3E %7B%0A%0A%09pr
@@ -250,28 +250,30 @@
 ger, Account
-Read
+Modifi
 able%3E map = 
@@ -318,36 +318,38 @@
 oid save(Account
-Read
+Modifi
 able account) %7B%0A
@@ -422,28 +422,30 @@
 blic Account
-Read
+Modifi
 able find(In
@@ -538,28 +538,30 @@
 date(Account
-Read
+Modifi
 able account
@@ -698,12 +698,14 @@
 ount
-Read
+Modifi
 able

change type to AccountModifiable