commit 2d11392a574d476a680b81b08035114291f708f1 Author: WummerMIB Date: Sat Dec 10 17:05:00 2022 +0100 first commit 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 0000000..2f3e3a1 Binary files /dev/null and b/bin/wordCount/Main.class differ 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); + } + +}