@@ -0,0 +1,1968 @@
+package com.cloudycrew.cloudycar.requeststorage;%0A%0Aimport com.cloudycrew.cloudycar.Identifiable;%0Aimport com.cloudycrew.cloudycar.observables.IObservable;%0Aimport com.cloudycrew.cloudycar.observables.IObserver;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.HashSet;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0A/**%0A * Created by George on 2016-10-28.%0A */%0A%0Apublic class Store%3CT extends Identifiable%3E implements IObservable%3CStore%3CT%3E%3E %7B%0A    private Map%3CString, T%3E itemsMap;%0A    private Set%3CIObserver%3C? super Store%3CT%3E%3E%3E observers;%0A%0A    public Store() %7B%0A        itemsMap = new LinkedHashMap%3C%3E();%0A        observers = new HashSet%3C%3E();%0A    %7D%0A%0A    public List%3CT%3E getItems() %7B%0A        return new ArrayList%3C%3E(itemsMap.values());%0A    %7D%0A%0A    public void setAll(Collection%3C? extends T%3E items) %7B%0A        items.clear();%0A        for (T item: items) %7B%0A            itemsMap.put(item.getId(), item);%0A        %7D%0A        notifyObservers();%0A    %7D%0A%0A    public void addItem(T item) %7B%0A        itemsMap.put(item.getId(), item);%0A        notifyObservers();%0A    %7D%0A%0A    public void updateItem(T item) %7B%0A        if (itemsMap.containsKey(item.getId())) %7B%0A            itemsMap.put(item.getId(), item);%0A            notifyObservers();%0A        %7D%0A    %7D%0A%0A    public void deleteItem(String itemId) %7B%0A        if (itemsMap.containsKey(itemId)) %7B%0A            itemsMap.remove(itemId);%0A            notifyObservers();%0A        %7D%0A    %7D%0A%0A    protected void notifyObservers() %7B%0A        for (IObserver%3C? super Store%3CT%3E%3E observer: observers) %7B%0A            observer.notifyUpdate(this);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void addObserver(IObserver%3C? super Store%3CT%3E%3E observer) %7B%0A        observers.add(observer);%0A    %7D%0A%0A    @Override%0A    public void removeObserver(IObserver%3C? super Store%3CT%3E%3E observer) %7B%0A        observers.remove(observer);%0A    %7D%0A%0A    @Override%0A    public void removeAllObservers() %7B%0A        observers.clear();%0A    %7D%0A%7D%0A

Create generic store