-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathList.java
More file actions
31 lines (28 loc) · 942 Bytes
/
List.java
File metadata and controls
31 lines (28 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package contacts_list;
import java.util.Collections;
import java.util.Scanner;
public class List extends Contact{
public static void list(){
Scanner in = new Scanner(System.in);
Contacts = ReadFromFile.read();
Menu.listMenu();
try{
Integer input = Integer.parseInt(in.nextLine());
if (input == 1) {
Collections.sort(Contacts, new NameComparator());
}
else if (input == 2) {
Collections.sort(Contacts, new NicknameComparator());
}
else if (input == 3) {}
for (Contact c : Contacts){
System.out.println(c.toString());
}
Menu.mainMenu();
}
catch (NumberFormatException n){
System.out.println("Helytelen beviteli formátum! Elfogadott: [1-3]");
Menu.listMenu();
}
}
}