Studieren Sie den zur Aufgabe gehörenden Lehrbrief und lösen Sie die Aufgaben darin. Testen Sie ihre Lösungen zunächst am besten interaktiv in der JShell.
package name.panitz.util;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.*;
import java.io.*;
import java.util.stream.Collectors;
import java.util.stream.*;
import java.math.BigInteger;
public interface Strom{
static long readBinary(String x){
return x.chars().reduce( /*TODO*/ );
}
static long quersumme(long x){
return LongStream
.iterate(x,(y)->y/10)
.takeWhile(y->y>0)
.reduce( /*TODO*/ );
}
static long factorial(int x){
return LongStream
.iterate(1L,(y)->y+1L)
.limit(x)
.reduce( /*TODO*/ );
}
static String asBinary(long x){
return (x==0) ? "0"
:LongStream
.iterate(x,(y)->y/2)
.takeWhile(y->y>0)
.mapToObj(y->y)
.reduce( /*TODO*/ );
}
static String convertToBase(int b,long x){
return "" /*TODO*/ ;
}
static String digits="0123456789ABFDEFGHIJKLMNOPQRSTUVWXYZ";
static char toDigit(int x){
return digits.charAt(x);
}
static long readFromBase(int b,String x){
return 0L /*TODO*/ ;
}
public static record TwoLong(long i1, long i2){}
static public Stream<TwoLong> fibPairs(){
//TODO
return null;
}
static public Stream<Long> fibs(){
//TODO
return null;
}
static public Stream<Long> fibs100(){
//TODO
return null;
}
static public long fib(int n){
//TODO
return 0L;
}
static public record TwoBig(BigInteger i1, BigInteger i2){}
static public Stream<TwoBig> facPairs(){
//TODO
return null;
}
static public Stream<BigInteger> facs(){
//TODO
return null;
}
static public BigInteger fac(int n){
//TODO
return null;
}
static public class SpliterateString
implements Spliterator<Character> {
int i = 0;
int end;
String s;
public SpliterateString(String s) {
this(0, s.length() - 1, s);
}
public SpliterateString(int i, int end, String s) {
this.i = i;this.end = end;this.s = s;
}
}
}