Skip to content

Commit

Permalink
add Stream.noneMatch operator (#106), update workflow with latest maj…
Browse files Browse the repository at this point in the history
…or action releases and temurin dist

* add Stream.noneMatch operator

* update workflow
  • Loading branch information
davidmoten authored May 2, 2024
1 parent f743da5 commit ad82aca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8', '11']
java: ['8', '11','17']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
distribution: 'temurin'
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v4
with:
file: ./**/target/site/jacoco/jacoco.xml
name: codecov
Expand All @@ -41,7 +41,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
uses: dependabot/fetch-metadata@v2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
Expand Down
4 changes: 4 additions & 0 deletions kool/src/main/java/org/davidmoten/kool/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,10 @@ default Stream<T> filter(Predicate<? super T> function) {
default Single<Boolean> exists(Predicate<? super T> function) {
return filter(function).isEmpty().map(x -> !x);
}

default Single<Boolean> noneMatch(Predicate<? super T> function) {
return filter(function).isEmpty();
}

default void forEach() {
count().get();
Expand Down
10 changes: 10 additions & 0 deletions kool/src/test/java/org/davidmoten/kool/StreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,16 @@ public void testExists() {
public void testExistsReturnsFalse() {
assertFalse(Stream.of(1, 2, 3).exists(x -> x == 4).get());
}

@Test
public void testNoneMatch() {
assertTrue(Stream.of(1, 2, 3).noneMatch(x -> x == 4).get());
}

@Test
public void testNoneMatchReturnsFalse() {
assertFalse(Stream.of(1, 2, 3).noneMatch(x -> x == 1).get());
}

@SuppressWarnings("unchecked")
@Test
Expand Down

0 comments on commit ad82aca

Please sign in to comment.