From 34ddbc6eafd094802fc3dbae254d3ad89292712d Mon Sep 17 00:00:00 2001 From: Alexander <139718933+AlexBa16@users.noreply.github.com> Date: Thu, 13 Feb 2025 22:30:18 +0100 Subject: [PATCH] add UE14 --- src/UE14_130225_Streams/UE14_Streams.java | 55 ++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/src/UE14_130225_Streams/UE14_Streams.java b/src/UE14_130225_Streams/UE14_Streams.java index aa54467..8a91221 100644 --- a/src/UE14_130225_Streams/UE14_Streams.java +++ b/src/UE14_130225_Streams/UE14_Streams.java @@ -1,4 +1,57 @@ package UE14_130225_Streams; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + public class UE14_Streams { -} + public static void main(String[] args) { +// zahlenreihen(); +// printFolgeOhne3(1); +// printFolgeOhne3(5); +// printFolgeOhne3(10); +// printFolgeOhne3(20); + wuerfelStatistik(6); + } + + public static void zahlenreihen() { + IntStream.rangeClosed(1, 25).forEach(n -> System.out.print(n + " ")); + System.out.println(); + IntStream.rangeClosed(1, 25).filter(n -> n % 2 != 0).forEach(n -> System.out.print(n + " ")); + System.out.println(); + IntStream.iterate(20, n -> n - 5).limit(9).forEach(n -> System.out.print(n + " ")); + System.out.println(); + IntStream.iterate(1, n -> n * 2).limit(7).forEach(n -> System.out.print(n + " ")); + System.out.println(); + AtomicInteger power = new AtomicInteger(1); + IntStream.iterate(2, n -> n + power.getAndUpdate(x -> x * 2)).limit(8).forEach(n -> System.out.print(n + " ")); + System.out.println(); + } + + public static void printFolgeOhne3(int anz) { + IntStream.iterate(4, n -> n + 1).filter(n -> n % 3 != 0).limit(anz).forEach(n -> System.out.print(n + " ")); + System.out.println(); + } + + public static void wuerfelStatistik(int augenzahl) { + } + + public static void alleTeiler(int z) { + } + + public static boolean istPrimzahl(int z) { + return true; + } + + public static int gaussSumme(int n) { + return 0; + } + + public static void verticalString(String s) { + } + + public static void mitStern(String s) { + } + + public static void deleteBlanks(String s1) { + } +} \ No newline at end of file