Example usage for java.util.stream IntStream filter

List of usage examples for java.util.stream IntStream filter

Introduction

In this page you can find the example usage for java.util.stream IntStream filter.

Prototype

IntStream filter(IntPredicate predicate);

Source Link

Document

Returns a stream consisting of the elements of this stream that match the given predicate.

Usage

From source file:Main.java

public static void main(String[] args) {
    IntStream i = IntStream.of(1, 2, 3, 4);
    i.filter(n -> n % 2 == 0).forEach(System.out::println);
}