1234567891011121314151617181920212223 |
- import java.util.TreeMap;
- import java.util.Map;
-
- /**
- * Created by Mexi Liang on 06/11/18.
- */
- public class PhoneBook {
- String name = "";
- String phoneNumber= "";
- Map<String,String> phoneBook = new TreeMap<>();
- public void addEntry(String name,String phoneNumber){
- phoneBook.put(name, phoneNumber);
- }
-
- public void removeEntry(String name){
- phoneBook.remove(name);
- }
-
- public int size(){
- return phoneBook.size(); //return size of the phonebook
- }
- }
|