12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import java.util.*;
- import java.util.Scanner;
- /**
- * Write a description of class PhoneBook here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class PhoneBook{
- Map<List, String> phonebook = new HashMap<>();
- List<String> multipleNumbers = new LinkedList<>();
- // public static boolean electronicPhonebook = true;
- // Scanner input = new Scanner(System.in);
- // HashMap<List, String> c;
- // Iterator<String> iter = c.iterator();
- public PhoneBook(){
- }
-
- public void add(List <String> number, String name){
- phonebook.put(number, name);
- }
-
- public void remove(String name){
- phonebook.remove(name);
- }
-
- public String lookup(String name){
- return phonebook.get(name);
- }
-
- public String reverseLookup(List number){
- return phonebook.get(number);
- }
-
- // public void removeRecord(){
- // iter.forEachRemaining(Map<List, String>, iter.remove(List));
- // }
-
- public void display(){
- System.out.println(" ***** WLECOME TO THE WORLD BOOK ***** ");
- for (Map.Entry<List,String> entry : phonebook.entrySet()){
- System.out.println("Όνομα: \n" + entry.getValue() + "\n" +
- "Αριθμός τηλεφώνου:" + "\n" + entry.getKey() + "\n");
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- // public void addMultiple(){
- //
- // while(electronicPhonebook = true){
- // System.out.println("Enter a number and then a name. ");
- // String number = input.nextLine();
- // String name = input.nextLine();
- // phonebook.put(number, name);
- //
- // System.out.println("Are you done adding entries¿");
- // String exit = input.nextLine();
- // if (exit.equalsIgnoreCase("yes") || exit.equalsIgnoreCase("yeah") || exit.equalsIgnoreCase("Affirmative")){
- // electronicPhonebook = false;
- // } else
- // if (exit.equalsIgnoreCase("no") || exit.equalsIgnoreCase("nope") || exit.equalsIgnoreCase("nah")){
- // System.out.println("Okay...");
- // } else {System.out.println("I guess not...");
- // }
- // }
- // }
-
-
- // public static void commandCenter(){
- // PhoneBook runningbook = new PhoneBook();
- // while(electronicPhonebook = true){
- // runningbook.addMultiple();
- // }
- //
- // }
- }
|