package andmevood; import java.util.stream.Stream; import java.util.function.Consumer; public class Vood2 { public static void main(String[] args) { Consumer trykiEsitaht = s -> { System.out.println(s.substring(0, 1)); }; Consumer trykiViimane = s -> { System.out.println(s.substring(s.length()-1)); }; String[] eesnimed = { "Juku", "Anu", "Kati", "Mati", "Kati" }; Consumer tegevus=trykiViimane; Stream.of(eesnimed).forEach(tegevus); } }