X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=exo5%2FMain.java;h=dfd22af190b95c44f14d70c072a92882aabe5df9;hb=HEAD;hp=3e0f331bbaa4890a33b724ec1f265811dc3ad5fe;hpb=a1aa04de75e28577a5c1c28ff6cf25ca6b2f913c;p=Project_POO.git diff --git a/exo5/Main.java b/exo5/Main.java index 3e0f331..dfd22af 100644 --- a/exo5/Main.java +++ b/exo5/Main.java @@ -23,7 +23,6 @@ class Main { Scanner sc = new Scanner(f); while (sc.hasNext()) { String wordCursor = sc.next(); - Integer count = tm.get(wordCursor); if (count == null) { count = 0; @@ -47,12 +46,12 @@ class Main { System.out.println("Word \"" + wordCursor + "\" occured " + sm.get(wordCursor) + " times"); } - System.out.println("Map content of duplicates inferior to the word \"milieu\":"); + System.out.println("Map content of exactly duplicated word inferior to the word \"milieu\":"); Map m1 = tm.entrySet().stream() .filter(map -> map.getKey().compareTo("milieu") < 0 && map.getValue() == 2) .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); for (String wordCursor : m1.keySet()) { - System.out.println("Word \"" + wordCursor + "\" occured " + sm.get(wordCursor) + " times"); + System.out.println("Word \"" + wordCursor + "\" occured " + m1.get(wordCursor) + " times"); } System.out.println("Map content of duplicates with occurence between 2 and 5:"); @@ -60,7 +59,7 @@ class Main { .filter(map -> map.getValue() >= 2 && map.getValue() <= 5) .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); for (String wordCursor : m2.keySet()) { - System.out.println("Word \"" + wordCursor + "\" occured " + sm.get(wordCursor) + " times"); + System.out.println("Word \"" + wordCursor + "\" occured " + m2.get(wordCursor) + " times"); } } }