package algus; import java.util.stream.Stream; public class ArvuProov2 { public static double geomKeskmine (Double[] arvud){ return Math.pow(Stream.of(arvud).reduce(1.0, (puhver, arv) -> puhver*arv), 1.0/arvud.length); } public static void main(String[] args) { // Stream.of(4, 7, 6).forEach(System.out::println); System.out.println(Stream.of(4, 7, 6).reduce(0, Integer::max)); System.out.println(Stream.of("Madis", "Anu", "Mait").reduce( "xxxxxxxxx", (siiani, uus) -> ((uus.length() < siiani.length()) ? uus : siiani))); //Anu System.out.println(geomKeskmine(new Double[]{3.0, 4.0, 20.0})); } }