Small code cleanups.
[Project_POO.git] / exo5 / Main.java
index 6a780291e35fc7025c3e84ef8410156c76d116d8..c5b80c42e573d08078519a99ffb74f5df89fa749 100644 (file)
@@ -2,6 +2,7 @@ import java.io.File;
 import java.util.Scanner;
 import java.io.IOException;
 import java.util.TreeMap;
+import java.util.SortedMap;
 
 class Main {
 
@@ -30,8 +31,16 @@ class Main {
         catch (IOException e) {
             e.printStackTrace();
         }
+
+        System.out.println("TreeMap full content:");
         for (String wordCursor : tm.keySet()) {
             System.out.println("Word \"" + wordCursor + "\" occured " + tm.get(wordCursor) + " times");
         }
+
+        System.out.println("SortedMap content after the word \"milieu\":");
+        SortedMap<String, Integer> sm = tm.tailMap("milieu");
+        for (String wordCursor : sm.keySet()) {
+            System.out.println("Word \"" + wordCursor + "\" occured " + sm.get(wordCursor) + " times");
+        }
     }
 }