add UE14
This commit is contained in:
@@ -1,4 +1,57 @@
|
|||||||
package UE14_130225_Streams;
|
package UE14_130225_Streams;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class UE14_Streams {
|
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) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user