Created
March 8, 2012 08:00
-
-
Save enesakar/1999547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyMapStore implements MapStore<String,Contact> { | |
public void store(String key, Contact contact) { | |
DataService.getInstance().addContact(contact.getPhone(), contact.getName()); | |
} | |
public void storeAll(Map<String, Contact> contactMap) { | |
for(String key: contactMap.keySet()) { | |
store(key, contactMap.get(key)); | |
} | |
} | |
public void delete(String key) { | |
} | |
public void deleteAll(Collection<String> strings) { | |
} | |
public Contact load(String key) { | |
return DataService.getInstance().loadContact(key); | |
} | |
public Map<String, Contact> loadAll(Collection<String> keys) { | |
Map<String, Contact> contactMap = new HashMap<String, Contact>(); | |
List<Contact> contacts= DataService.getInstance().loadAllContacts(keys); | |
for(Contact contact: contacts) { | |
contactMap.put(contact.getPhone(), contact); | |
} | |
return contactMap; | |
} | |
public Set<String> loadAllKeys() { | |
return DataService.getInstance().loadAllKeys(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment