String[]strings="this is an array of strings".split(" ");longcount=Arrays.stream(strings).map(String::length)// .count();// System.out.println("There are "+count+" strings");inttotalLength=Arrays.stream(strings).mapToInt(String::length)// .sum();// System.out.println("The total length is "+totalLength);OptionalDoubleave=Arrays.stream(strings).mapToInt(String::length).average();// System.out.println("The average length is "+ave);OptionalIntmax=Arrays.stream(strings).mapToInt(String::length).max();// OptionalIntmin=Arrays.stream(strings).mapToInt(String::length).min();//
BigDecimaltotal=Stream.iterate(BigDecimal.ONE,n->n.add(BigDecimal.ONE)).limit(10).reduce(BigDecimal.ZERO,(acc,val)->acc.add(val));System.out.println("The total is "+total);