package algus; import java.util.stream.Stream; public class ArvuProov3 { public static void main(String[] args) { Stream.of(3, 8, 7, 6, 5).limit(2).forEach(System.out::println); Stream.of(2, 1, 3, 3, 4).skip(2).forEach(System.out::println); System.out.println( (Stream.of(5, 1, 3, 3, 7).anyMatch(a -> a % 2==0) ? "leidub paaris" : "pole paaris")); System.out.println( (Stream.of(5, 1, 3, 6, 7).allMatch(a -> a % 2==1) ? "kõik paaritud" : "leidub mõni paaris")); System.out.println( (Stream.of(5, 1, 3, 5, 7).noneMatch(a -> a % 2==0) ? "Pole ühtki paaris" : "leidub mõni paaris")); } }