From 2d11392a574d476a680b81b08035114291f708f1 Mon Sep 17 00:00:00 2001 From: WummerMIB Date: Sat, 10 Dec 2022 17:05:00 +0100 Subject: [PATCH] first commit --- .classpath | 10 ++++++++++ .project | 17 +++++++++++++++++ .settings/org.eclipse.jdt.core.prefs | 14 ++++++++++++++ bin/wordCount/Main.class | Bin 0 -> 2305 bytes src/wordCount/Main.java | 20 ++++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 bin/wordCount/Main.class create mode 100644 src/wordCount/Main.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..9f9bbb5 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..d5d744c --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + WordCount + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8aabe8d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=16 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=16 diff --git a/bin/wordCount/Main.class b/bin/wordCount/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..2f3e3a19bda6dcf5a59ef527cce7a86d288fe317 GIT binary patch literal 2305 zcma)6ZFdtz6n>^@yXkh@hSU}Tfq*Tv1-exb(5)zqR?q~{lp^BWB$=e!Zg%6ov?u-_ zzpEc0 z)e#K&l2_x-CiiW5?+J&)EjyqDrF2${BDN?y!|cMd(oyzG=-Y17THMrdB2`wR$YPqo zstdp1d!Z;a96S7xE>aNKwXH%^1flTV0(V=&sS7vO>~WtIO#&xe9WywoVfG+)6xxn? z*Y|lRFz`A~5pEuo?0^WEPZgHXVl5`M#%|Kg8pj!&)$j)K8lyPW7&wRX6fOvT!CMSx z7F6FvY7#0^T6ub&3kELYO@iZ+Uy1sE-!8Hw63B^&az5oW6C4j6=#D{j+(XoQJHN2Jb>Qz|u z9EaM>^NIHBxItbu*^%`24ChkF|LtJOus03d!fgh<>3dO|yw-@ZC&$B6u=m9r0R6DS znCbTnSXd=8Yf0e@D{8h^1ym-=(m=yBal{`z$rwJwnufav-58r!I@H5014Vp9!{o$f3%n6deJgv7SwDflm8i6U-^5GR$gnPcSEAe~0|9D`pgNfR*A` z@@QE|udKsc)jFSBVYsH^B&y^?3zRuV8BJiWm7cv2M%NIwm*uvV3KFjy2BPgU(js@9iX94TY7}*bODd%F@>T~RhaDXZu7M3a zCeKz5j~R^nt}Fba!-GHs8t94U`kmo{sBs3c2)oY literal 0 HcmV?d00001 diff --git a/src/wordCount/Main.java b/src/wordCount/Main.java new file mode 100644 index 0000000..786cfc0 --- /dev/null +++ b/src/wordCount/Main.java @@ -0,0 +1,20 @@ +package wordCount; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class Main { + + public static void main(String[] args) { + List g = Arrays.asList("der rote flitzer der sich gestern anmelden der war gegangen"); + + Map result = g.stream().flatMap(s -> Arrays.stream(s.split(" "))) + .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); + + System.out.println(result); + } + +}