Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws IOException {
- LinkedHashMap<String, String> hashMap = new LinkedHashMap<>();
- LinkedList<String> list = new LinkedList<>();
- LinkedList<Integer> list2 = new LinkedList<>();
- LinkedHashMap<String, Integer> hashMap2 = new LinkedHashMap<>();
- File file = new File("C:\\Users\\Plaza\\IdeaProjects\\HelloWorld\\src\\capitals.txt");
- File file2 = new File("C:\\Users\\Plaza\\IdeaProjects\\HelloWorld\\src\\capitals.txt");
- File file3 = new File("testLog.txt");
- if (args[0].equals("-import")) {
- if (args[1].equals("capitals.txt")) {
- int N = 0;
- Scanner skaner = null;
- try {
- skaner = new Scanner(file);
- while (skaner.hasNext()) {
- String question = skaner.nextLine();
- String answer = skaner.nextLine();
- String error = skaner.nextLine();
- hashMap.put(question, answer);
- hashMap2.put(question, Integer.valueOf(error));
- N++;
- }
- } finally {
- if (skaner != null) {
- skaner.close();
- }
- }
- System.out.println(N + " cards have been loaded.");
- list.add(N + " cards have been loaded.");
- }
- } else if (args[0].equals("-export")) {
- if (args[1].equals("capitalsNew.txt")) {
- listaMap(hashMap, hashMap2, file2);
- } else if (args[1].equals("capitals.txt")) {
- listaMap(hashMap, hashMap2, file);
- }
- if (args[2].equals("exit")) {
- System.out.println("Bye bye!");
- System.out.println(hashMap.size() + " cards have been saved.");
- System.exit(0);
- list.add(hashMap.size() + " cards have been saved.");
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment