package andmevood; import java.util.Arrays; import java.util.stream.Stream; public class Vood1 { public static void main(String[] args) { String[] eesnimed={"Juku", "Anu", "Kati", "Mati", "Kati"}; Stream.of(eesnimed).forEach(System.out::println); Stream nimevoog=Stream.of(eesnimed); nimevoog.distinct().forEach(System.out::println); //nimevoog.distinct().forEach(System.out::println); //topelt ei saa Stream.of(eesnimed).map(s -> s.substring(0, 1)).forEach(System.out::print); String[] esitahed=Stream.of(eesnimed). map(s -> s.substring(0, 1)).toArray(String[]::new); System.out.println(Arrays.toString(esitahed)); } }