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 phonebook = new HashMap<>(); List multipleNumbers = new LinkedList<>(); // public static boolean electronicPhonebook = true; // Scanner input = new Scanner(System.in); // Collection c; // Iterator iter = c.iterator(); public PhoneBook(){ } public void add(List multipleNumbers, String name){ phonebook.put(multipleNumbers, 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 display(){ System.out.println(" ***** WLECOME TO THE WORLD BOOK ***** "); for (Map.Entry 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(); // } // // } }