---
title: "Stream - Match"
author: "fairy_xzc"
date: "2018-06-19T21:52:57Z"
tags: []
categories: ["编程语言"]
slug: "stream-match"
draft: false
lastmod: "2018-06-19T21:41:20Z"
id: 2425204
url: "https://agilestyle.iteye.com/blog/2425204"
---

**原创转载请注明出处：[http://agilestyle.iteye.com/blog/2425204](/blog/2425204)**

 

## allMatch

```
private static void allMatch() {
    Stream<Integer> stream = Arrays.stream(new Integer[]{1, 2, 3, 4, 5, 6, 7});

    boolean result = stream.allMatch(i -> i > 0);

    System.out.println(result);
}
```

 

## anyMatch

```
private static void anyMatch() {
    Stream<Integer> stream = Arrays.stream(new Integer[]{1, 2, 3, 4, 5, 6, 7});

    boolean result = stream.anyMatch(i -> i > 6);

    System.out.println(result);
}
```

 

## noneMatch

```
private static void noneMatch() {
    Stream<Integer> stream = Arrays.stream(new Integer[]{1, 2, 3, 4, 5, 6, 7});

    boolean result = stream.noneMatch(i -> i < 0);

    System.out.println(result);
}
```