diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000000..def5ba5d90
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,12 @@
+version: 2
+updates:
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+
+ - package-ecosystem: "gradle"
+ directory: "/"
+ schedule:
+ interval: "daily"
diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml
new file mode 100644
index 0000000000..3bb843889a
--- /dev/null
+++ b/.github/workflows/gradle-wrapper-validation.yml
@@ -0,0 +1,13 @@
+name: "Validate Gradle Wrapper"
+on: [push, pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ validation:
+ name: "Validation"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3.5.0
diff --git a/.github/workflows/gradle_branch.yml b/.github/workflows/gradle_branch.yml
new file mode 100644
index 0000000000..8fd55412ec
--- /dev/null
+++ b/.github/workflows/gradle_branch.yml
@@ -0,0 +1,37 @@
+# This workflow will build a Java project with Gradle
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
+
+name: Branch
+
+on:
+ push:
+ branches-ignore: [ '3.x' ]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - name: Set up JDK 11
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
+ with:
+ distribution: 'zulu'
+ java-version: '11'
+ - name: Cache Gradle packages
+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ with:
+ path: ~/.gradle/caches
+ key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/*.gradle') }}
+ restore-keys: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+ - name: Build RxJava
+ run: ./gradlew build --stacktrace
+ - name: Upload to Codecov
+ uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
+ - name: Generate Javadoc
+ run: ./gradlew javadoc --stacktrace
diff --git a/.github/workflows/gradle_jdk11.yml b/.github/workflows/gradle_jdk11.yml
new file mode 100644
index 0000000000..5eed0fa3da
--- /dev/null
+++ b/.github/workflows/gradle_jdk11.yml
@@ -0,0 +1,42 @@
+# This workflow will build a Java project with Gradle
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
+
+name: JDK 11
+
+on:
+ push:
+ branches: [ 3.x ]
+ pull_request:
+ branches: [ 3.x ]
+
+permissions:
+ contents: read
+
+env:
+ BUILD_WITH_11: true
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - name: Set up JDK 11
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
+ with:
+ distribution: 'zulu'
+ java-version: '11'
+ - name: Cache Gradle packages
+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ with:
+ path: ~/.gradle/caches
+ key: ${{ runner.os }}-gradle-1-${{ hashFiles('**/*.gradle') }}
+ restore-keys: ${{ runner.os }}-gradle-1-
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+ - name: Verify generated module-info
+ run: ./gradlew -PjavaCompatibility=9 jar
+ - name: Build RxJava
+ run: ./gradlew build --stacktrace
+# - name: Generate Javadoc
+# run: ./gradlew javadoc --stacktrace
diff --git a/.github/workflows/gradle_pr.yml b/.github/workflows/gradle_pr.yml
new file mode 100644
index 0000000000..ba0bc523ad
--- /dev/null
+++ b/.github/workflows/gradle_pr.yml
@@ -0,0 +1,37 @@
+# This workflow will build a Java project with Gradle
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
+
+name: Pull Request
+
+on:
+ pull_request:
+ branches: [ 3.x ]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - name: Set up JDK 11
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
+ with:
+ distribution: 'zulu'
+ java-version: '11'
+ - name: Cache Gradle packages
+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ with:
+ path: ~/.gradle/caches
+ key: ${{ runner.os }}-gradle-1-${{ hashFiles('**/*.gradle') }}
+ restore-keys: ${{ runner.os }}-gradle-1-
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+ - name: Build RxJava
+ run: ./gradlew build --stacktrace
+ - name: Upload to Codecov
+ uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
+ - name: Generate Javadoc
+ run: ./gradlew javadoc --stacktrace
diff --git a/.github/workflows/gradle_release.yml b/.github/workflows/gradle_release.yml
new file mode 100644
index 0000000000..4c65fc24ed
--- /dev/null
+++ b/.github/workflows/gradle_release.yml
@@ -0,0 +1,70 @@
+# This workflow will build a Java project with Gradle
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
+
+name: Release
+
+on:
+ release:
+ types: [ released, prereleased ]
+ branches: [ '3.x' ]
+ tags:
+ - 'v3.*.*'
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ env:
+ CI_BUILD_NUMBER: ${{ github.run_number }}
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - name: Set up JDK 11
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
+ with:
+ distribution: 'zulu'
+ java-version: '11'
+ - name: Cache Gradle packages
+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ with:
+ path: ~/.gradle/caches
+ key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/*.gradle') }}
+ restore-keys: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+ - name: Grant execute permission for push
+ run: chmod +x push_javadoc.sh
+ - name: Extract version tag
+ run: echo "BUILD_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
+ - name: Build RxJava
+ run: ./gradlew build --stacktrace --no-daemon
+ - name: Upload to Codecov
+ uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
+# - name: Upload release
+# run: ./gradlew -PreleaseMode=full publish --no-daemon --no-parallel --stacktrace
+# env:
+# # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
+# # ------------------------------------------------------------------------------
+# ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }}
+# ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
+# ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }}
+# ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
+ - name: Publish release
+ run: ./gradlew -PreleaseMode=full publishAndReleaseToMavenCentral --no-configuration-cache --no-daemon --no-parallel --stacktrace
+ env:
+ # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
+ # ------------------------------------------------------------------------------
+ ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }}
+ ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
+ ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }}
+ ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
+ - name: Push Javadoc
+ run: ./push_javadoc.sh
+ env:
+ # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
+ # ------------------------------------------------------------------------------
+ JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }}
diff --git a/.github/workflows/gradle_snapshot.yml b/.github/workflows/gradle_snapshot.yml
new file mode 100644
index 0000000000..4a29e0757a
--- /dev/null
+++ b/.github/workflows/gradle_snapshot.yml
@@ -0,0 +1,56 @@
+# This workflow will build a Java project with Gradle
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
+
+name: Snapshot
+
+on:
+ push:
+ branches: [ '3.x' ]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ if: github.repository == 'ReactiveX/RxJava'
+ permissions:
+ contents: write
+ env:
+ # ------------------------------------------------------------------------------
+ CI_BUILD_NUMBER: ${{ github.run_number }}
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - name: Set up JDK 11
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
+ with:
+ distribution: 'zulu'
+ java-version: '11'
+ - name: Cache Gradle packages
+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ with:
+ path: ~/.gradle/caches
+ key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/*.gradle') }}
+ restore-keys: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+ - name: Grant execute permission for push
+ run: chmod +x push_javadoc.sh
+ - name: Build RxJava
+ run: ./gradlew build --stacktrace --no-daemon
+ - name: Upload Snapshot
+ run: ./gradlew -PreleaseMode=branch publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel --stacktrace
+ env:
+ # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
+ # ------------------------------------------------------------------------------
+ ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }}
+ ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
+ - name: Upload to Codecov
+ uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
+ - name: Push Javadoc
+ run: ./push_javadoc.sh
+ # Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
+ # ------------------------------------------------------------------------------
+ env:
+ JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }}
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
new file mode 100644
index 0000000000..fa9ad404f0
--- /dev/null
+++ b/.github/workflows/scorecard.yml
@@ -0,0 +1,59 @@
+name: Scorecard supply-chain security
+on:
+ # For Branch-Protection check. Only the default branch is supported. See
+ # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
+ branch_protection_rule:
+ # To guarantee Maintained check is occasionally updated. See
+ # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
+ schedule:
+ - cron: '43 12 * * 4'
+ push:
+ branches: [ "3.x" ]
+
+permissions: read-all
+
+jobs:
+ analysis:
+ name: Scorecard analysis
+ runs-on: ubuntu-latest
+ permissions:
+ # Needed to upload the results to code-scanning dashboard.
+ security-events: write
+ # Needed to publish results and get a badge (see publish_results below).
+ id-token: write
+
+ steps:
+ - name: "Checkout code"
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: false
+
+ - name: "Run analysis"
+ uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
+ with:
+ results_file: results.sarif
+ results_format: sarif
+ # (Optional) "write" PAT token. Uncomment the `repo_token` line below if
+ # you want to enable the Branch-Protection check on a *public* repository
+ # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-fine-grained-pat-optional.
+ # repo_token: ${{ secrets.SCORECARD_TOKEN }}
+
+ # - Publish results to OpenSSF REST API for easy access by consumers
+ # - Allows the repository to include the Scorecard badge.
+ # - See https://github.com/ossf/scorecard-action#publishing-results.
+ publish_results: true
+
+ # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
+ # format to the repository Actions tab.
+ - name: "Upload artifact"
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: SARIF file
+ path: results.sarif
+ retention-days: 5
+
+ # Upload the results to GitHub's code scanning dashboard.
+ - name: "Upload to code-scanning"
+ uses: github/codeql-action/upload-sarif@303c0aef88fc2fe5ff6d63d3b1596bfd83dfa1f9 # v3.29.5
+ with:
+ sarif_file: results.sarif
diff --git a/.gitignore b/.gitignore
index 428d55b2fb..b60171cf2d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,4 +73,10 @@ bin/
# PMD files
.pmd
.ruleset
-test-output/
\ No newline at end of file
+test-output/
+
+# Checkstyle local config
+.checkstyle
+
+# Some editor's config
+.editorconfig
diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 0000000000..954870bba6
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,139 @@
+## Learn more about this file at 'https://www.gitpod.io/docs/references/gitpod-yml'
+##
+## This '.gitpod.yml' file when placed at the root of a project instructs
+## Gitpod how to prepare & build the project, start development environments
+## and configure continuous prebuilds. Prebuilds when enabled builds a project
+## like a CI server so you can start coding right away - no more waiting for
+## dependencies to download and builds to finish when reviewing pull-requests
+## or hacking on something new.
+##
+## With Gitpod you can develop software from any device (even iPads) via
+## desktop or browser based versions of VS Code or any JetBrains IDE and
+## customise it to your individual needs - from themes to extensions, you
+## have full control.
+##
+## The easiest way to try out Gitpod is install the browser extenion:
+## 'https://www.gitpod.io/docs/browser-extension' or by prefixing
+## 'https://gitpod.io#' to the source control URL of any project.
+##
+## For example: 'https://gitpod.io#https://github.com/gitpod-io/gitpod'
+
+
+## The 'image' section defines which Docker image Gitpod should use.
+## By default, Gitpod uses a standard Docker Image called 'workspace-full'
+## which can be found at 'https://github.com/gitpod-io/workspace-images'
+##
+## Workspaces started based on this default image come pre-installed with
+## Docker, Go, Java, Node.js, C/C++, Python, Ruby, Rust, PHP as well as
+## tools such as Homebrew, Tailscale, Nginx and several more.
+##
+## If this image does not include the tools needed for your project then
+## a public Docker image or your own Docker file can be configured.
+##
+## Learn more about images at 'https://www.gitpod.io/docs/config-docker'
+
+#image: node:buster # use 'https://hub.docker.com/_/node'
+#
+#image: # leave image undefined if using a Dockerfile
+# file: .gitpod.Dockerfile # relative path to the Dockerfile from the
+# # root of the project
+
+## The 'tasks' section defines how Gitpod prepares and builds this project
+## or how Gitpod can start development servers. With Gitpod, there are three
+## types of tasks:
+##
+## - before: Use this for tasks that need to run before init and before command.
+## - init: Use this to configure prebuilds of heavy-lifting tasks such as
+## downloading dependencies or compiling source code.
+## - command: Use this to start your database or application when the workspace starts.
+##
+## Learn more about these tasks at 'https://www.gitpod.io/docs/config-start-tasks'
+
+#tasks:
+# - before: |
+# # commands to execute...
+#
+# - init: |
+# # sudo apt-get install python3 # can be used to install operating system
+# # dependencies but these are not kept after the
+# # prebuild completes thus Gitpod recommends moving
+# # operating system dependency installation steps
+# # to a custom Dockerfile to make prebuilds faster
+# # and to keep your codebase DRY.
+# # 'https://www.gitpod.io/docs/config-docker'
+#
+# # pip install -r requirements.txt # install codebase dependencies
+# # cmake # precompile codebase
+#
+# - name: Web Server
+# openMode: split-left
+# env:
+# WEBSERVER_PORT: 8080
+# command: |
+# python3 -m http.server $WEBSERVER_PORT
+#
+# - name: Web Browser
+# openMode: split-right
+# env:
+# WEBSERVER_PORT: 8080
+# command: |
+# gp await-port $WEBSERVER_PORT
+# lynx `gp url`
+
+tasks:
+ - command: ./gradlew build
+
+## The 'ports' section defines various ports your may listen on are
+## configured in Gitpod on an authenticated URL. By default, all ports
+## are in private visibility state.
+##
+## Learn more about ports at 'https://www.gitpod.io/docs/config-ports'
+
+#ports:
+# - port: 8080 # alternatively configure entire ranges via '8080-8090'
+# visibility: private # either 'public' or 'private' (default)
+# onOpen: open-browser # either 'open-browser', 'open-preview' or 'ignore'
+
+
+## The 'vscode' section defines a list of Visual Studio Code extensions from
+## the OpenVSX.org registry to be installed upon workspace startup. OpenVSX
+## is an open alternative to the proprietary Visual Studio Code Marketplace
+## and extensions can be added by sending a pull-request with the extension
+## identifier to https://github.com/open-vsx/publish-extensions
+##
+## The identifier of an extension is always ${publisher}.${name}.
+##
+## For example: 'vscodevim.vim'
+##
+## Learn more at 'https://www.gitpod.io/docs/ides-and-editors/vscode'
+
+#vscode:
+# extensions:
+# - vscodevim.vim
+# - esbenp.prettier-vscode@9.5.0
+# - https://example.com/abc/releases/extension-0.26.0.vsix
+
+
+## The 'github' section defines configuration of continuous prebuilds
+## for GitHub repositories when the GitHub application
+## 'https://github.com/apps/gitpod-io' is installed in GitHub and granted
+## permissions to access the repository.
+##
+## Learn more at 'https://www.gitpod.io/docs/prebuilds'
+
+github:
+ prebuilds:
+ # enable for the default branch
+ master: true
+ # enable for all branches in this repo
+ branches: true
+ # enable for pull requests coming from this repo
+ pullRequests: true
+ # enable for pull requests coming from forks
+ pullRequestsFromForks: true
+ # add a check to pull requests
+ addCheck: true
+ # add a "Review in Gitpod" button as a comment to pull requests
+ addComment: false
+ # add a "Review in Gitpod" button to the pull request's description
+ addBadge: true
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 6e595b4e93..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-language: java
-jdk:
-- openjdk8
-
-# prevent travis running gradle assemble; let the build script do it anyway
-install: true
-
-# running in container causes test failures and 2x-3x longer build, use standalone instances
-sudo: required
-
-# script for build and release via Travis to Bintray
-script: gradle/buildViaTravis.sh
-
-# Code coverage
-after_success:
- - bash <(curl -s --retry 10 https://codecov.io/bash)
- - bash gradle/push_javadoc.sh
-
-# cache between builds
-cache:
- directories:
- - $HOME/.m2
- - $HOME/.gradle
-env:
- global:
- - secure: YcLpYfNc/dyDON+oDvnJK5pFNhpPeJHxlAHV8JBt42e51prAl6njqrg1Qlfdp0pvBiskTPQHUxbFy9DOB1Z+43lPj5vlqz6qBgtS3vtBnsrczr+5Xx7NTdVKq6oZGl45VjfNPT7zdM6GQ5ifdzOid6kJIFu34g9JZkCzOY3BWGM=
- - secure: WVmfSeW1UMNdem7+X4cVDjkEkqdeNavYH4udn3bFN1IFaWdliWFp4FYVBVi+p1T/IgkRSqzoW9Bm43DABe1UMFoErFCbfd7B0Ofgb4NZAsxFgokHGVLCe6k5+rQyASseiO7k0itSj3Kq9TrDueKPhv+g+IG0w1A8yZTnXdhXHvY=
- - secure: Xt8E09nmSr+5r7ly95hG/EiBitZbhFGPRGp8oqPkNn1A2fzG9+hnvlNLgQhVPsISZGzJwkWa3LGBxAVGmuysVOz7eCwkoqlDZaaSLYAPfWXqkr+cmYGPkErgHSp+n/hnQG4TylX0YxzqX8flr6db21zWyNduiyHmo+xFydI5LeM=
- - secure: RmpIsmYa5BdLLWR6DILjhEE/dx2q3O0NIkvnMx5G1cyRCNCrOf1B7fYFHnsTDwpvRA+6H6dZinmeyf6D3G+czOG5q/TW2jcu5nh+YOLhBb6jPIqRDfq/WHAa5Lkdssxs5g9RdWlEDVFMoE62lGc4cnfJz5F5puH29dy2SvXxIQw=
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4547f563a8..98ae7225f3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -13,19 +13,16 @@ All files are released with the Apache 2.0 license.
If you are adding a new file it should have a header like this:
```
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
+ * the License for the specific language governing permissions and limitations under the License.
*/
```
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000000..5d2c6e53f3
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,13 @@
+Copyright (c) 2016-present, RxJava Contributors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/README.md b/README.md
index 698aa96f40..9963ffee46 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,10 @@
# RxJava: Reactive Extensions for the JVM
-
+
[](https://codecov.io/gh/ReactiveX/RxJava/branch/3.x)
[](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava3/rxjava)
+[](https://gitpod.io/#https://github.com/ReactiveX/RxJava)
+[](https://securityscorecards.dev/viewer/?uri=github.com/ReactiveX/RxJava)
RxJava is a Java VM implementation of [Reactive Extensions](http://reactivex.io): a library for composing asynchronous and event-based programs by using observable sequences.
@@ -10,22 +12,27 @@ It extends the [observer pattern](http://en.wikipedia.org/wiki/Observer_pattern)
#### Version 3.x ([Javadoc](http://reactivex.io/RxJava/3.x/javadoc/))
-- single dependency: [Reactive-Streams](https://github.com/reactive-streams/reactive-streams-jvm)
-- Java 8+ ([Android](https://github.com/ReactiveX/RxAndroid) desugar friendly)
-- Java 8 lambda-friendly API
-- fixed API mistakes and many limits of RxJava 2
-- intended to be a replacement for RxJava 2 with relatively few binary incompatible changes
-- non-opinionated about the source of concurrency (threads, pools, event loops, fibers, actors, etc.)
-- async or synchronous execution
-- virtual time and schedulers for parameterized concurrency
-- test and diagnostic support via test schedulers, test consumers and plugin hooks
+- Single dependency: [Reactive-Streams](https://github.com/reactive-streams/reactive-streams-jvm).
+- Java 8+ or Android API 21+ required.
+- Java 8 lambda-friendly API.
+- [Android](https://github.com/ReactiveX/RxAndroid) desugar friendly.
+- Fixed API mistakes and many limits of RxJava 2.
+- Intended to be a replacement for RxJava 2 with relatively few binary incompatible changes.
+- Non-opinionated about the source of concurrency (threads, pools, event loops, fibers, actors, etc.).
+- Async or synchronous execution.
+- Virtual time and schedulers for parameterized concurrency.
+- Test and diagnostic support via test schedulers, test consumers and plugin hooks.
+- Interop with newer JDK versions via 3rd party libraries, such as
+ - [Java 9 Flow API](https://github.com/akarnokd/RxJavaJdk9Interop#rxjavajdk9interop)
+ - [Java 21 Virtual Threads](https://github.com/akarnokd/RxJavaFiberInterop#rxjavafiberinterop)
Learn more about RxJava in general on the Wiki Home.
+:information_source: Please read the [What's different in 3.0](https://github.com/ReactiveX/RxJava/wiki/What's-different-in-3.0) for details on the changes and migration information when upgrading from 2.x.
+
#### Version 2.x
-The [2.x version](https://github.com/ReactiveX/RxJava/tree/2.x) will be supported with bugfixes and important documentation updates until
-**December 31, 2020**. No new features will be added to 2.x.
+The [2.x version](https://github.com/ReactiveX/RxJava/tree/2.x) is end-of-life as of **February 28, 2021**. No further development, support, maintenance, PRs and updates will happen. The [Javadoc]([Javadoc](http://reactivex.io/RxJava/2.x/javadoc/)) of the very last version, **2.2.21**, will remain accessible.
#### Version 1.x
@@ -194,7 +201,7 @@ RxJava operators don't work with `Thread`s or `ExecutorService`s directly but wi
- `Schedulers.single()`: Run work on a single thread in a sequential and FIFO manner.
- `Schedulers.trampoline()`: Run work in a sequential and FIFO manner in one of the participating threads, usually for testing purposes.
-These are available on all JVM platforms but some specific platforms, such as Android, have their own typical `Scheduler`s defined: `AndroidSchedulers.mainThread()`, `SwingScheduler.instance()` or `JavaFXSchedulers.gui()`.
+These are available on all JVM platforms but some specific platforms, such as Android, have their own typical `Scheduler`s defined: `AndroidSchedulers.mainThread()`, `SwingScheduler.instance()` or `JavaFXScheduler.platform()`.
In addition, there is an option to wrap an existing `Executor` (and its subtypes such as `ExecutorService`) into a `Scheduler` via `Schedulers.from(Executor)`. This can be used, for example, to have a larger but still fixed pool of threads (unlike `computation()` and `io()` respectively).
@@ -503,7 +510,7 @@ For further details, consult the [wiki](https://github.com/ReactiveX/RxJava/wiki
- Google Group: [RxJava](http://groups.google.com/d/forum/rxjava)
- Twitter: [@RxJava](http://twitter.com/RxJava)
- [GitHub Issues](https://github.com/ReactiveX/RxJava/issues)
-- StackOverflow: [rx-java](http://stackoverflow.com/questions/tagged/rx-java) and [rx-java2](http://stackoverflow.com/questions/tagged/rx-java2)
+- StackOverflow: [rx-java](http://stackoverflow.com/questions/tagged/rx-java), [rx-java2](http://stackoverflow.com/questions/tagged/rx-java2) and [rx-java3](http://stackoverflow.com/questions/tagged/rx-java3)
- [Gitter.im](https://gitter.im/ReactiveX/RxJava)
## Versioning
@@ -524,7 +531,7 @@ APIs marked with the [`@Experimental`][experimental source link] annotation at t
#### @Deprecated
-APIs marked with the `@Deprecated` annotation at the class or method level will remain supported until the next major release but it is recommended to stop using them.
+APIs marked with the `@Deprecated` annotation at the class or method level will remain supported until the next major release, but it is recommended to stop using them.
#### io.reactivex.rxjava3.internal.*
@@ -564,19 +571,19 @@ and for Ivy:
### Snapshots
-Snapshots are available via https://oss.jfrog.org/libs-snapshot/io/reactivex/rxjava3/rxjava/
+Snapshots after May 19st, 2025 are available via https://central.sonatype.com/repository/maven-snapshots/io/reactivex/rxjava3/rxjava/
```groovy
repositories {
- maven { url 'https://oss.jfrog.org/libs-snapshot' }
+ maven { url 'https://central.sonatype.com/repository/maven-snapshots' }
}
dependencies {
- compile 'io.reactivex.rxjava3:rxjava:3.0.0-SNAPSHOT'
+ implementation 'io.reactivex.rxjava3:rxjava:3.0.0-SNAPSHOT'
}
```
-JavaDoc snapshots are available at http://reactivex.io/RxJava/3.x/javadoc/snapshot
+JavaDoc snapshots are available at https://reactivex.io/RxJava/3.x/javadoc/snapshot
## Build
@@ -611,5 +618,5 @@ For bugs, questions and discussions please use the [Github Issues](https://githu
See the License for the specific language governing permissions and
limitations under the License.
-[beta source link]: https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/annotations/Beta.java
-[experimental source link]: https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/annotations/Experimental.java
+[beta source link]: https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/annotations/Beta.java
+[experimental source link]: https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/annotations/Experimental.java
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000000..1003574331
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,7 @@
+# Security Policy
+
+If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
+
+Please disclose it at [security advisory](https://github.com/ReactiveX/RxJava/security/advisories/new).
+
+This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.
diff --git a/build.gradle b/build.gradle
index ce041a954f..8bcfddb717 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,76 +1,39 @@
-buildscript {
-
- // Dependency versions
- // ---------------------------------------
-
- ext.reactiveStreamsVersion = "1.0.3"
- ext.junitVersion = "4.13"
- ext.testNgVersion = "7.0.0"
- ext.mockitoVersion = "3.2.4"
- ext.jmhLibVersion = "1.21"
- ext.jmhGradleVersion = "0.5.0"
- ext.guavaVersion = "28.2-jre"
- ext.jacocoVersion = "0.8.4"
- ext.animalSnifferVersion = "1.5.0"
- ext.licenseVersion = "0.15.0"
- ext.bintrayVersion = "1.8.4"
- ext.jfrogExtractorVersion = "4.13.0"
- ext.bndVersion = "4.3.1"
- ext.checkstyleVersion = "8.26"
-
- // --------------------------------------
-
- repositories {
- jcenter()
- mavenCentral()
- maven {
- url "https://plugins.gradle.org/m2/"
- }
- }
- dependencies {
- classpath "ru.vyarus:gradle-animalsniffer-plugin:$animalSnifferVersion"
- classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:$licenseVersion"
- classpath "me.champeau.gradle:jmh-gradle-plugin:$jmhGradleVersion"
- classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayVersion"
- classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$jfrogExtractorVersion"
- classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:$bndVersion"
- }
-}
-
-group = "io.reactivex.rxjava3"
-ext.githubProjectName = "rxjava"
-
-version = project.properties["release.version"]
-
-def releaseTag = System.getenv("TRAVIS_TAG");
+plugins {
+ id("java-library")
+ id("checkstyle")
+ id("eclipse")
+ id("jacoco")
+ id("maven-publish")
+ id("ru.vyarus.animalsniffer") version "2.0.1"
+ id("me.champeau.jmh") version "0.7.3"
+ id("com.github.hierynomus.license") version "0.16.1"
+ id("biz.aQute.bnd.builder") version "6.4.0"
+ id("com.vanniktech.maven.publish") version "0.33.0"
+ id("org.beryx.jar") version "2.0.0"
+ id("signing")
+}
+
+ext {
+ reactiveStreamsVersion = "1.0.4"
+ junitVersion = "4.13.2"
+ testNgVersion = "7.5"
+ mockitoVersion = "4.11.0"
+ jmhLibVersion = "1.21"
+ guavaVersion = "33.5.0-jre"
+}
+
+def releaseTag = System.getenv("BUILD_TAG")
if (releaseTag != null && !releaseTag.isEmpty()) {
if (releaseTag.startsWith("v")) {
- releaseTag = releaseTag.substring(1);
+ releaseTag = releaseTag.substring(1)
}
- version = releaseTag;
- project.properties.put("release.version", releaseTag);
+ project.version = releaseTag
- println("Releasing with version " + version);
+ logger.lifecycle("Releasing with version: " + project.version)
}
-description = "RxJava: Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM."
-
-apply plugin: "java-library"
-apply plugin: "checkstyle"
-apply plugin: "jacoco"
-apply plugin: "ru.vyarus.animalsniffer"
-apply plugin: "maven"
-apply plugin: "me.champeau.gradle.jmh"
-apply plugin: "com.github.hierynomus.license"
-apply plugin: "com.jfrog.bintray"
-apply plugin: "com.jfrog.artifactory"
-apply plugin: "eclipse"
-
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-
repositories {
- mavenCentral()
+ mavenCentral()
}
dependencies {
@@ -87,12 +50,27 @@ dependencies {
testImplementation "com.google.guava:guava:$guavaVersion"
}
+def buildWith11 = System.getenv("BUILD_WITH_11")
+java {
+ toolchain {
+ vendor = JvmVendorSpec.ADOPTIUM
+ if ("true".equals(buildWith11)) {
+ languageVersion = JavaLanguageVersion.of(11)
+ } else {
+ languageVersion = JavaLanguageVersion.of(8)
+ }
+ }
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
tasks.withType(JavaCompile) {
- options.compilerArgs << "-parameters";
+ options.compilerArgs << "-parameters"
}
+apply from: file("gradle/javadoc_cleanup.gradle")
+
javadoc {
- failOnError = false
exclude "**/internal/**"
exclude "**/test/**"
exclude "**/perf/**"
@@ -104,111 +82,57 @@ javadoc {
options.addStringOption("top").value = ""
options.addStringOption("doctitle").value = ""
options.addStringOption("header").value = ""
- options.stylesheetFile = new File(projectDir, "gradle/stylesheet.css");
+ options.stylesheetFile = project.file("gradle/stylesheet.css")
options.links(
- "https://docs.oracle.com/javase/8/docs/api/",
- "http://www.reactive-streams.org/reactive-streams-${reactiveStreamsVersion}-javadoc/"
+ "https://docs.oracle.com/javase/8/docs/api/",
+ "https://reactivex.io/RxJava/org.reactivestreams.javadoc/${reactiveStreamsVersion}/"
)
+
+ finalizedBy javadocCleanup
}
animalsniffer {
annotation = "io.reactivex.rxjava3.internal.util.SuppressAnimalSniffer"
}
-task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = "sources"
- from sourceSets.main.allSource
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = "javadoc"
- from javadoc.destinationDir
-}
-
-artifacts {
- archives jar
- archives sourcesJar
- archives javadocJar
+moduleConfig {
+ moduleInfoPath = 'src/main/module/module-info.java'
+ multiReleaseVersion = 9
+ version = project.version
}
-apply plugin: 'biz.aQute.bnd.builder'
-
jar {
- bnd ('Bundle-Name': 'rxjava',
- 'Bundle-Vendor': 'RxJava Contributors',
- 'Bundle-Description': 'Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.',
- 'Import-Package': '!org.junit,!junit.framework,!org.mockito.*,!org.testng.*,*',
- 'Bundle-DocURL': 'https://github.com/ReactiveX/RxJava',
- 'Eclipse-ExtensibleAPI': 'true',
- 'Automatic-Module-Name': 'io.reactivex.rxjava3',
- 'Export-Package': '!io.reactivex.rxjava3.internal.*, io.reactivex.rxjava3.*'
+ from('.') {
+ include 'LICENSE'
+ include 'COPYRIGHT'
+ into('META-INF/')
+ }
+ exclude("module-info.class")
+
+ // Cover for bnd still not supporting MR Jars: https://github.com/bndtools/bnd/issues/2227
+ bnd('-fixupmessages': '^Classes found in the wrong directory: \\\\{META-INF/versions/9/module-info\\\\.class=module-info}$')
+ bnd(
+ "Bundle-Name": "rxjava",
+ "Bundle-Vendor": "RxJava Contributors",
+ "Bundle-Description": "Reactive Extensions for the JVM - a library for composing asynchronous and event-based programs using observable sequences for the Java VM.",
+ "Import-Package": "!org.junit,!junit.framework,!org.mockito.*,!org.testng.*,*",
+ "Bundle-DocURL": "https://github.com/ReactiveX/RxJava",
+ "Eclipse-ExtensibleAPI": "true",
+ "Export-Package": "!io.reactivex.rxjava3.internal.*, io.reactivex.rxjava3.*",
+ "Bundle-SymbolicName": "io.reactivex.rxjava3.rxjava",
+ "Multi-Release": "true"
)
}
license {
- header rootProject.file("HEADER")
+ header project.file("config/license/HEADER")
ext.year = Calendar.getInstance().get(Calendar.YEAR)
skipExistingHeaders true
ignoreFailures true
excludes(["**/*.md", "**/*.txt"])
}
-apply plugin: "maven-publish"
-
-install {
- repositories.mavenInstaller.pom.project {
- name "RxJava"
- description "Reactive Extensions for Java"
- url "https://github.com/ReactiveX/RxJava"
- licenses {
- license {
- name "The Apache Software License, Version 2.0"
- url "http://www.apache.org/licenses/LICENSE-2.0.txt"
- distribution "repo"
- }
- }
- developers {
- developer {
- id "akarnokd"
- name "David Karnok"
- email "akarnokd@gmail.com"
- }
- }
- scm {
- connection "scm:git:git@github.com:ReactiveX/RxJava.git"
- url "scm:git:git@github.com:ReactiveX/RxJava.git"
- developerConnection "scm:git:git@github.com:ReactiveX/RxJava.git"
- }
- issueManagement {
- system "github"
- url "https://github.com/ReactiveX/RxJava/issues"
- }
- }
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
- artifact (sourcesJar) {
- classifier = "sources"
- }
- }
- }
-}
-
-// Reactive-Streams as compile dependency
-publishing.publications.all {
- pom.withXml {
- asNode().dependencies."*".findAll() {
- it.scope.text() == "runtime" && project.configurations.compile.allDependencies.find { dep ->
- dep.name == it.artifactId.text()
- }
- }.each { it.scope*.value = "compile"}
- }
-}
-
jmh {
jmhVersion = jmhLibVersion
humanOutputFile = null
@@ -217,162 +141,79 @@ jmh {
jvmArgsAppend = ["-Djmh.separateClasspathJAR=true"]
if (project.hasProperty("jmh")) {
- include = ".*" + project.jmh + ".*"
- println("JMH: " + include);
+ includes = [".*" + project.jmh + ".*"]
+ logger.info("JMH: {}", includes)
}
+}
+test {
+ maxHeapSize = "1200m"
}
-plugins.withType(EclipsePlugin) {
- project.eclipse.classpath.plusConfigurations += [ configurations.jmh ]
+task testNG(type: Test) {
+ useTestNG()
}
-test {
-
- testLogging {
- // showing skipped occasionally should prevent CI timeout due to lack of standard output
- events=["skipped", "failed"] // "started", "passed"
- // showStandardStreams = true
- exceptionFormat="full"
+check.dependsOn testNG
+
+tasks.withType(Test) {
+ testLogging {
+ events = ["skipped", "failed"]
+ exceptionFormat = "full"
debug.events = ["skipped", "failed"]
- debug.exceptionFormat="full"
+ debug.exceptionFormat = "full"
info.events = ["failed", "skipped"]
- info.exceptionFormat="full"
-
+ info.exceptionFormat = "full"
+
warn.events = ["failed", "skipped"]
- warn.exceptionFormat="full"
+ warn.exceptionFormat = "full"
}
- maxHeapSize = "1200m"
-
if (System.getenv("CI") == null) {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
}
-task testng(type: Test) {
- useTestNG()
- testLogging {
- events=["skipped", "failed"]
- exceptionFormat="full"
-
- debug.events = ["skipped", "failed"]
- debug.exceptionFormat="full"
-
- info.events = ["failed", "skipped"]
- info.exceptionFormat="full"
-
- warn.events = ["failed", "skipped"]
- warn.exceptionFormat="full"
- }
-}
-
-check.dependsOn testng
-
-jacoco {
- toolVersion = jacocoVersion // See http://www.eclemma.org/jacoco/.
-}
-
-task GCandMem(dependsOn: "check") doLast {
- print("Memory usage before: ")
- println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0)
- System.gc()
- Thread.sleep(200)
- print("Memory usage: ")
- println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0)
-}
-
-task GCandMem2(dependsOn: "test") doLast {
- print("Memory usage before: ")
- println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0)
- System.gc()
- Thread.sleep(200)
- print("Memory usage: ")
- println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0)
-}
-
-testng.dependsOn GCandMem2
-
jacocoTestReport {
+ dependsOn test
+ dependsOn testNG
+
reports {
- xml.enabled = true
- html.enabled = true
+ xml.required.set(true)
+ csv.required.set(false)
+ html.required.set(true)
}
}
-jacocoTestReport.dependsOn GCandMem
-
-build.dependsOn jacocoTestReport
+check.dependsOn jacocoTestReport
checkstyle {
- configFile file("checkstyle.xml")
- ignoreFailures = true
- toolVersion = checkstyleVersion
+ configFile = project.file("config/checkstyle/checkstyle.xml")
+ configProperties = [
+ "checkstyle.suppressions.file": project.file("config/checkstyle/suppressions.xml"),
+ "checkstyle.header.file" : project.file("config/license/HEADER_JAVA")
+ ]
+ checkstyleMain.exclude '**/module-info.java'
}
-if (rootProject.hasProperty("releaseMode")) {
-
- if ("branch".equals(rootProject.releaseMode)) {
- // From https://github.com/ReactiveX/RxAndroid/blob/2.x/rxandroid/build.gradle#L94
-
- println("ReleaseMode: " + rootProject.releaseMode);
- artifactory {
- contextUrl = "https://oss.jfrog.org"
-
- publish {
- repository {
- repoKey = "oss-snapshot-local"
-
- username = rootProject.bintrayUser
- password = rootProject.bintrayKey
- }
-
- defaults {
- publishConfigs("archives")
- }
- }
+if (project.hasProperty("releaseMode")) {
+ logger.lifecycle("ReleaseMode: {}", project.releaseMode)
+
+
+ if ("full" == project.releaseMode) {
+ signing {
+ if (project.hasProperty("SIGNING_PRIVATE_KEY") && project.hasProperty("SIGNING_PASSWORD")) {
+ useInMemoryPgpKeys(project.getProperty("SIGNING_PRIVATE_KEY"), project.getProperty("SIGNING_PASSWORD"))
+ sign(publishing.publications)
+ }
}
-
- build.finalizedBy(artifactoryPublish)
}
+ mavenPublishing {
+ // or when publishing to https://central.sonatype.com/
+ publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
- if ("full".equals(rootProject.releaseMode)) {
- // based on https://github.com/bintray/gradle-bintray-plugin
- def rver = version;
-
- println("ReleaseMode: " + rootProject.releaseMode + " version " + rver);
-
- bintray {
- user = rootProject.bintrayUser
- key = rootProject.bintrayKey
- configurations = ["archives"]
- publish = true
- pkg {
- repo = "RxJava"
- name = "RxJava"
- userOrg = "reactivex"
- labels = ["rxjava", "reactivex"]
- licenses = ["Apache-2.0"]
- vcsUrl = "https://github.com/ReactiveX/RxJava.git"
- version {
- name = rver
- gpg {
- sign = true
- }
- mavenCentralSync {
- sync = true
- user = rootProject.sonatypeUsername
- password = rootProject.sonatypePassword
- close = "1"
- }
- }
- }
- }
-
- build.finalizedBy(bintrayUpload)
- }
+ // signAllPublications()
+ }
}
-
-apply from: file("gradle/javadoc_cleanup.gradle")
diff --git a/checkstyle.xml b/checkstyle.xml
deleted file mode 100644
index 3e7ba879da..0000000000
--- a/checkstyle.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000..05896aee12
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml
new file mode 100644
index 0000000000..cf580e45e6
--- /dev/null
+++ b/config/checkstyle/suppressions.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HEADER b/config/license/HEADER
similarity index 100%
rename from HEADER
rename to config/license/HEADER
diff --git a/config/license/HEADER_JAVA b/config/license/HEADER_JAVA
new file mode 100644
index 0000000000..d95b44938b
--- /dev/null
+++ b/config/license/HEADER_JAVA
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2016-present, RxJava Contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
+ * the License for the specific language governing permissions and limitations under the License.
+ */
diff --git a/docs/Additional-Reading.md b/docs/Additional-Reading.md
index 85e7d47077..4badd81308 100644
--- a/docs/Additional-Reading.md
+++ b/docs/Additional-Reading.md
@@ -3,7 +3,7 @@ A more complete and up-to-date list of resources can be found at the [reactivex.
# Introducing Reactive Programming
* [Introduction to Rx](http://www.introtorx.com/): a free, on-line book by Lee Campbell **(1.x)**
* [The introduction to Reactive Programming you've been missing](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754) by Andre Staltz
-* [Mastering Observables](http://docs.couchbase.com/developer/java-2.0/observables.html) from the Couchbase documentation **(1.x)**
+* [Mastering Observables](https://docs.huihoo.com/couchbase/developer-guide/java-2.0/observables.html) from the Couchbase documentation **(1.x)**
* [Reactive Programming in Java 8 With RxJava](http://pluralsight.com/training/Courses/TableOfContents/reactive-programming-java-8-rxjava), a course designed by Russell Elledge **(1.x)**
* [33rd Degree Reactive Java](http://www.slideshare.net/tkowalcz/33rd-degree-reactive-java) by Tomasz Kowalczewski **(1.x)**
* [What Every Hipster Should Know About Functional Reactive Programming](http://www.infoq.com/presentations/game-functional-reactive-programming) - Bodil Stokke demos the creation of interactive game mechanics in RxJS
diff --git a/docs/Backpressure-(2.0).md b/docs/Backpressure-(2.0).md
index 61361d21c4..6b2f2860af 100644
--- a/docs/Backpressure-(2.0).md
+++ b/docs/Backpressure-(2.0).md
@@ -172,7 +172,7 @@ If some of the values can be safely ignored, one can use the sampling (with time
}
```
-Note hovewer that these operators only reduce the rate of value reception by the downstream and thus they may still lead to `MissingBackpressureException`.
+Note however that these operators only reduce the rate of value reception by the downstream and thus they may still lead to `MissingBackpressureException`.
## onBackpressureBuffer()
@@ -229,7 +229,7 @@ Note that the last two strategies cause discontinuity in the stream as they drop
## onBackpressureDrop()
-Whenever the downstream is not ready to receive values, this operator will drop that elemenet from the sequence. One can think of it as a 0 capacity `onBackpressureBuffer` with strategy `ON_OVERFLOW_DROP_LATEST`.
+Whenever the downstream is not ready to receive values, this operator will drop that element from the sequence. One can think of it as a 0 capacity `onBackpressureBuffer` with strategy `ON_OVERFLOW_DROP_LATEST`.
This operator is useful when one can safely ignore values from a source (such as mouse moves or current GPS location signals) as there will be more up-to-date values later on.
diff --git a/docs/Backpressure.md b/docs/Backpressure.md
index bfe90330bb..8529ec0995 100644
--- a/docs/Backpressure.md
+++ b/docs/Backpressure.md
@@ -20,7 +20,7 @@ Cold Observables are ideal for the reactive pull model of backpressure described
Your first line of defense against the problems of over-producing Observables is to use some of the ordinary set of Observable operators to reduce the number of emitted items to a more manageable number. The examples in this section will show how you might use such operators to handle a bursty Observable like the one illustrated in the following marble diagram:
-
+
By fine-tuning the parameters to these operators you can ensure that a slow-consuming observer is not overwhelmed by a fast-producing Observable.
@@ -33,7 +33,7 @@ The following diagrams show how you could use each of these operators on the bur
### sample (or throttleLast)
The `sample` operator periodically "dips" into the sequence and emits only the most recently emitted item during each dip:
-
+
```java
Observable burstySampled = bursty.sample(500, TimeUnit.MILLISECONDS);
```
@@ -41,7 +41,7 @@ Observable burstySampled = bursty.sample(500, TimeUnit.MILLISECONDS);
### throttleFirst
The `throttleFirst` operator is similar, but emits not the most recently emitted item, but the first item that was emitted after the previous "dip":
-
+
```java
Observable burstyThrottled = bursty.throttleFirst(500, TimeUnit.MILLISECONDS);
```
@@ -49,7 +49,7 @@ Observable burstyThrottled = bursty.throttleFirst(500, TimeUnit.MILLISE
### debounce (or throttleWithTimeout)
The `debounce` operator emits only those items from the source Observable that are not followed by another item within a specified duration:
-
+
```java
Observable burstyDebounced = bursty.debounce(10, TimeUnit.MILLISECONDS);
```
@@ -64,14 +64,14 @@ The following diagrams show how you could use each of these operators on the bur
You could, for example, close and emit a buffer of items from the bursty Observable periodically, at a regular interval of time:
-
+
```java
Observable> burstyBuffered = bursty.buffer(500, TimeUnit.MILLISECONDS);
```
Or you could get fancy, and collect items in buffers during the bursty periods and emit them at the end of each burst, by using the `debounce` operator to emit a buffer closing indicator to the `buffer` operator:
-
+
```java
// we have to multicast the original bursty Observable so we can use it
// both as our source and as the source for our buffer closing selector:
@@ -86,14 +86,14 @@ Observable> burstyBuffered = burstyMulticast.buffer(burstyDebounce
`window` is similar to `buffer`. One variant of `window` allows you to periodically emit Observable windows of items at a regular interval of time:
-
+
```java
Observable> burstyWindowed = bursty.window(500, TimeUnit.MILLISECONDS);
````
You could also choose to emit a new window each time you have collected a particular number of items from the source Observable:
-
+
```java
Observable> burstyWindowed = bursty.window(5);
```
@@ -128,7 +128,7 @@ someObservable.subscribe(new Subscriber() {
}
@Override
- public void onNext(t n) {
+ public void onNext(T n) {
// do something with the emitted item "n"
// request another item:
request(1);
@@ -158,18 +158,18 @@ For this to work, though, Observables _A_ and _B_ must respond correctly to the
onBackpressureBuffer
-
maintains a buffer of all emissions from the source Observable and emits them to downstream Subscribers according to the requests they generate an experimental version of this operator (not available in RxJava 1.0) allows you to set the capacity of the buffer; applying this operator will cause the resulting Observable to terminate with an error if this buffer is overrun
+
maintains a buffer of all emissions from the source Observable and emits them to downstream Subscribers according to the requests they generate an experimental version of this operator (not available in RxJava 1.0) allows you to set the capacity of the buffer; applying this operator will cause the resulting Observable to terminate with an error if this buffer is overrun
onBackpressureDrop
-
drops emissions from the source Observable unless there is a pending request from a downstream Subscriber, in which case it will emit enough items to fulfill the request
+
drops emissions from the source Observable unless there is a pending request from a downstream Subscriber, in which case it will emit enough items to fulfill the request
onBackpressureBlock(experimental, not in RxJava 1.0)
-
blocks the thread on which the source Observable is operating until such time as a Subscriber issues a request for items, and then unblocks the thread only so long as there are pending requests
+
blocks the thread on which the source Observable is operating until such time as a Subscriber issues a request for items, and then unblocks the thread only so long as there are pending requests
* Like {@code Observable}, a running {@code Completable} can be stopped through the {@link Disposable} instance
- * provided to consumers through {@link SingleObserver#onSubscribe}.
+ * provided to consumers through {@link CompletableObserver#onSubscribe}.
*
* Like an {@code Observable}, a {@code Completable} is lazy, can be either "hot" or "cold", synchronous or
* asynchronous. {@code Completable} instances returned by the methods of this class are cold
@@ -165,7 +166,7 @@ public static Completable amb(@NonNull Iterable<@NonNull ? extends CompletableSo
*
Scheduler:
*
{@code complete} does not operate by default on a particular {@link Scheduler}.
*
- * @return a {@code Completable} instance that completes immediately
+ * @return the shared {@code Completable} instance
*/
@CheckReturnValue
@NonNull
@@ -177,13 +178,13 @@ public static Completable complete() {
/**
* Returns a {@code Completable} which completes only when all sources complete, one after another.
*
- *
+ *
*
*
Scheduler:
*
{@code concatArray} does not operate by default on a particular {@link Scheduler}.
*
* @param sources the sources to concatenate
- * @return the {@code Completable} instance which completes only when all sources complete
+ * @return the new {@code Completable} instance
* @throws NullPointerException if {@code sources} is {@code null}
*/
@CheckReturnValue
@@ -201,6 +202,27 @@ public static Completable concatArray(@NonNull CompletableSource... sources) {
return RxJavaPlugins.onAssembly(new CompletableConcatArray(sources));
}
+ /**
+ * Returns a {@code Completable} which completes only when all sources complete, one after another.
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code concatArrayDelayError} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param sources the sources to concatenate
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code sources} is {@code null}
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ @SafeVarargs
+ public static Completable concatArrayDelayError(@NonNull CompletableSource... sources) {
+ return Flowable.fromArray(sources).concatMapCompletableDelayError(Functions.identity(), true, 2);
+ }
+
/**
* Returns a {@code Completable} which completes only when all sources complete, one after another.
*
{@code concat} does not operate by default on a particular {@link Scheduler}.
*
* @param sources the sources to concatenate
- * @return the {@code Completable} instance which completes only when all sources complete
+ * @return the new {@code Completable} instance
* @throws NullPointerException if {@code sources} is {@code null}
*/
@CheckReturnValue
@@ -225,7 +247,7 @@ public static Completable concat(@NonNull Iterable<@NonNull ? extends Completabl
/**
* Returns a {@code Completable} which completes only when all sources complete, one after another.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Completable} honors the backpressure of the downstream consumer
@@ -234,7 +256,7 @@ public static Completable concat(@NonNull Iterable<@NonNull ? extends Completabl
*
{@code concat} does not operate by default on a particular {@link Scheduler}.
*
* @param sources the sources to concatenate
- * @return the {@code Completable} instance which completes only when all sources complete
+ * @return the new {@code Completable} instance
* @throws NullPointerException if {@code sources} is {@code null}
*/
@CheckReturnValue
@@ -248,7 +270,7 @@ public static Completable concat(@NonNull Publisher<@NonNull ? extends Completab
/**
* Returns a {@code Completable} which completes only when all sources complete, one after another.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Completable} honors the backpressure of the downstream consumer
@@ -258,7 +280,7 @@ public static Completable concat(@NonNull Publisher<@NonNull ? extends Completab
*
* @param sources the sources to concatenate
* @param prefetch the number of sources to prefetch from the sources
- * @return the {@code Completable} instance which completes only when all sources complete
+ * @return the new {@code Completable} instance
* @throws NullPointerException if {@code sources} is {@code null}
* @throws IllegalArgumentException if {@code prefetch} is non-positive
*/
@@ -272,6 +294,76 @@ public static Completable concat(@NonNull Publisher<@NonNull ? extends Completab
return RxJavaPlugins.onAssembly(new CompletableConcat(sources, prefetch));
}
+ /**
+ * Returns a {@code Completable} which completes only when all sources complete, one after another.
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code concatDelayError} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param sources the sources to concatenate
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code sources} is {@code null}
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public static Completable concatDelayError(@NonNull Iterable<@NonNull ? extends CompletableSource> sources) {
+ return Flowable.fromIterable(sources).concatMapCompletableDelayError(Functions.identity());
+ }
+
+ /**
+ * Returns a {@code Completable} which completes only when all sources complete, one after another.
+ *
+ *
+ *
+ *
Backpressure:
+ *
The returned {@code Completable} honors the backpressure of the downstream consumer
+ * and expects the other {@link Publisher} to honor it as well.
+ *
Scheduler:
+ *
{@code concatDelayError} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param sources the sources to concatenate
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code sources} is {@code null}
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @SchedulerSupport(SchedulerSupport.NONE)
+ @BackpressureSupport(BackpressureKind.FULL)
+ @NonNull
+ public static Completable concatDelayError(@NonNull Publisher<@NonNull ? extends CompletableSource> sources) {
+ return concatDelayError(sources, 2);
+ }
+
+ /**
+ * Returns a {@code Completable} which completes only when all sources complete, one after another.
+ *
+ *
+ *
+ *
Backpressure:
+ *
The returned {@code Completable} honors the backpressure of the downstream consumer
+ * and expects the other {@link Publisher} to honor it as well.
+ *
Scheduler:
+ *
{@code concatDelayError} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param sources the sources to concatenate
+ * @param prefetch the number of sources to prefetch from the sources
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code sources} is {@code null}
+ * @throws IllegalArgumentException if {@code prefetch} is non-positive
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ @BackpressureSupport(BackpressureKind.FULL)
+ public static Completable concatDelayError(@NonNull Publisher<@NonNull ? extends CompletableSource> sources, int prefetch) {
+ return Flowable.fromPublisher(sources).concatMapCompletableDelayError(Functions.identity(), true, prefetch);
+ }
+
/**
* Provides an API (via a cold {@code Completable}) that bridges the reactive world with the callback-style world.
*
@@ -322,6 +414,29 @@ public static Completable create(@NonNull CompletableOnSubscribe source) {
return RxJavaPlugins.onAssembly(new CompletableCreate(source));
}
+ /**
+ * Compares two {@link CompletableSource}s and emits {@code true} via a {@link Single} if both complete.
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code sequenceEqual} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param source1 the first {@code CompletableSource} instance
+ * @param source2 the second {@code CompletableSource} instance
+ * @return the new {@code Single} instance
+ * @throws NullPointerException if {@code source1} or {@code source2} is {@code null}
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public static Single sequenceEqual(@NonNull CompletableSource source1, @NonNull CompletableSource source2) { // NOPMD
+ Objects.requireNonNull(source1, "source1 is null");
+ Objects.requireNonNull(source2, "source2 is null");
+ return mergeArrayDelayError(source1, source2).andThen(Single.just(true));
+ }
+
/**
* Constructs a {@code Completable} instance by wrapping the given source callback
* without any safeguards; you should manage the lifecycle and response
@@ -332,21 +447,21 @@ public static Completable create(@NonNull CompletableOnSubscribe source) {
*
Scheduler:
*
{@code unsafeCreate} does not operate by default on a particular {@link Scheduler}.
*
- * @param source the callback which will receive the {@link CompletableObserver} instances
+ * @param onSubscribe the callback which will receive the {@link CompletableObserver} instances
* when the {@code Completable} is subscribed to.
- * @return the created {@code Completable} instance
- * @throws NullPointerException if {@code source} is {@code null}
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code onSubscribe} is {@code null}
* @throws IllegalArgumentException if {@code source} is a {@code Completable}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable unsafeCreate(@NonNull CompletableSource source) {
- Objects.requireNonNull(source, "source is null");
- if (source instanceof Completable) {
+ public static Completable unsafeCreate(@NonNull CompletableSource onSubscribe) {
+ Objects.requireNonNull(onSubscribe, "onSubscribe is null");
+ if (onSubscribe instanceof Completable) {
throw new IllegalArgumentException("Use of unsafeCreate(Completable)!");
}
- return RxJavaPlugins.onAssembly(new CompletableFromUnsafeSource(source));
+ return RxJavaPlugins.onAssembly(new CompletableFromUnsafeSource(onSubscribe));
}
/**
@@ -357,16 +472,16 @@ public static Completable unsafeCreate(@NonNull CompletableSource source) {
*
Scheduler:
*
{@code defer} does not operate by default on a particular {@link Scheduler}.
*
- * @param completableSupplier the supplier that returns the {@code Completable} that will be subscribed to.
- * @return the {@code Completable} instance
- * @throws NullPointerException if {@code completableSupplier} is {@code null}
+ * @param supplier the supplier that returns the {@code Completable} that will be subscribed to.
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code supplier} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable defer(@NonNull Supplier extends CompletableSource> completableSupplier) {
- Objects.requireNonNull(completableSupplier, "completableSupplier is null");
- return RxJavaPlugins.onAssembly(new CompletableDefer(completableSupplier));
+ public static Completable defer(@NonNull Supplier extends @NonNull CompletableSource> supplier) {
+ Objects.requireNonNull(supplier, "supplier is null");
+ return RxJavaPlugins.onAssembly(new CompletableDefer(supplier));
}
/**
@@ -381,16 +496,16 @@ public static Completable defer(@NonNull Supplier extends CompletableSource> c
*
Scheduler:
*
{@code error} does not operate by default on a particular {@link Scheduler}.
*
- * @param errorSupplier the error supplier, not {@code null}
+ * @param supplier the error supplier, not {@code null}
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code errorSupplier} is {@code null}
+ * @throws NullPointerException if {@code supplier} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable error(@NonNull Supplier extends Throwable> errorSupplier) {
- Objects.requireNonNull(errorSupplier, "errorSupplier is null");
- return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(errorSupplier));
+ public static Completable error(@NonNull Supplier extends @NonNull Throwable> supplier) {
+ Objects.requireNonNull(supplier, "supplier is null");
+ return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(supplier));
}
/**
@@ -401,21 +516,21 @@ public static Completable error(@NonNull Supplier extends Throwable> errorSupp
*
Scheduler:
*
{@code error} does not operate by default on a particular {@link Scheduler}.
*
- * @param error the {@code Throwable} instance to emit, not {@code null}
+ * @param throwable the {@code Throwable} instance to emit, not {@code null}
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code error} is {@code null}
+ * @throws NullPointerException if {@code throwable} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable error(@NonNull Throwable error) {
- Objects.requireNonNull(error, "error is null");
- return RxJavaPlugins.onAssembly(new CompletableError(error));
+ public static Completable error(@NonNull Throwable throwable) {
+ Objects.requireNonNull(throwable, "throwable is null");
+ return RxJavaPlugins.onAssembly(new CompletableError(throwable));
}
/**
- * Returns a {@code Completable} instance that runs the given {@link Action} for each subscriber and
- * emits either an unchecked exception or simply completes.
+ * Returns a {@code Completable} instance that runs the given {@link Action} for each {@link CompletableObserver} and
+ * emits either an exception or simply completes.
*
*
*
@@ -429,16 +544,16 @@ public static Completable error(@NonNull Throwable error) {
* {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.rxjava3.exceptions.UndeliverableException UndeliverableException}.
*
*
- * @param run the {@code Action} to run for each subscribing {@link CompletableObserver}
+ * @param action the {@code Action} to run for each subscribing {@code CompletableObserver}
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code run} is {@code null}
+ * @throws NullPointerException if {@code action} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable fromAction(@NonNull Action run) {
- Objects.requireNonNull(run, "run is null");
- return RxJavaPlugins.onAssembly(new CompletableFromAction(run));
+ public static Completable fromAction(@NonNull Action action) {
+ Objects.requireNonNull(action, "action is null");
+ return RxJavaPlugins.onAssembly(new CompletableFromAction(action));
}
/**
@@ -486,6 +601,7 @@ public static Completable fromCallable(@NonNull Callable> callable) {
* @param future the {@code Future} to react to
* @return the new {@code Completable} instance
* @throws NullPointerException if {@code future} is {@code null}
+ * @see #fromCompletionStage(CompletionStage)
*/
@CheckReturnValue
@NonNull
@@ -496,7 +612,7 @@ public static Completable fromFuture(@NonNull Future> future) {
}
/**
- * Returns a {@code Completable} instance that when subscribed to, subscribes to the {@link Maybe} instance and
+ * Returns a {@code Completable} instance that when subscribed to, subscribes to the {@link MaybeSource} instance and
* emits an {@code onComplete} event if the maybe emits {@code onSuccess}/{@code onComplete} or forwards any
* {@code onError} events.
*
{@code fromMaybe} does not operate by default on a particular {@link Scheduler}.
*
*
History: 2.1.17 - beta
- * @param the value type of the {@link MaybeSource} element
- * @param maybe the {@code Maybe} instance to subscribe to, not {@code null}
+ * @param the value type of the {@code MaybeSource} element
+ * @param maybe the {@code MaybeSource} instance to subscribe to, not {@code null}
* @return the new {@code Completable} instance
* @throws NullPointerException if {@code maybe} is {@code null}
* @since 2.2
@@ -515,21 +631,26 @@ public static Completable fromFuture(@NonNull Future> future) {
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable fromMaybe(@NonNull MaybeSource maybe) {
+ public static <@NonNull T> Completable fromMaybe(@NonNull MaybeSource maybe) {
Objects.requireNonNull(maybe, "maybe is null");
return RxJavaPlugins.onAssembly(new MaybeIgnoreElementCompletable<>(maybe));
}
/**
* Returns a {@code Completable} instance that runs the given {@link Runnable} for each {@link CompletableObserver} and
- * emits either its exception or simply completes.
+ * emits either its unchecked exception or simply completes.
*
*
+ *
+ * If the code to be wrapped needs to throw a checked or more broader {@link Throwable} exception, that
+ * exception has to be converted to an unchecked exception by the wrapped code itself. Alternatively,
+ * use the {@link #fromAction(Action)} method which allows the wrapped code to throw any {@code Throwable}
+ * exception and will signal it to observers as-is.
*
*
Scheduler:
*
{@code fromRunnable} does not operate by default on a particular {@link Scheduler}.
*
Error handling:
- *
If the {@code Runnable} throws an exception, the respective {@link Throwable} is
+ *
If the {@code Runnable} throws an exception, the respective {@code Throwable} is
* delivered to the downstream via {@link CompletableObserver#onError(Throwable)},
* except when the downstream has disposed this {@code Completable} source.
* In this latter case, the {@code Throwable} is delivered to the global error handler via
@@ -539,6 +660,7 @@ public static Completable fromMaybe(@NonNull MaybeSource maybe) {
* @param run the {@code Runnable} to run for each {@code CompletableObserver}
* @return the new {@code Completable} instance
* @throws NullPointerException if {@code run} is {@code null}
+ * @see #fromAction(Action)
*/
@CheckReturnValue
@NonNull
@@ -565,7 +687,7 @@ public static Completable fromRunnable(@NonNull Runnable run) {
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable fromObservable(@NonNull ObservableSource observable) {
+ public static <@NonNull T> Completable fromObservable(@NonNull ObservableSource observable) {
Objects.requireNonNull(observable, "observable is null");
return RxJavaPlugins.onAssembly(new CompletableFromObservable<>(observable));
}
@@ -603,7 +725,7 @@ public static Completable fromObservable(@NonNull ObservableSource observ
@NonNull
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable fromPublisher(@NonNull Publisher publisher) {
+ public static <@NonNull T> Completable fromPublisher(@NonNull Publisher publisher) {
Objects.requireNonNull(publisher, "publisher is null");
return RxJavaPlugins.onAssembly(new CompletableFromPublisher<>(publisher));
}
@@ -625,7 +747,7 @@ public static Completable fromPublisher(@NonNull Publisher publisher) {
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable fromSingle(@NonNull SingleSource single) {
+ public static <@NonNull T> Completable fromSingle(@NonNull SingleSource single) {
Objects.requireNonNull(single, "single is null");
return RxJavaPlugins.onAssembly(new CompletableFromSingle<>(single));
}
@@ -866,7 +988,7 @@ private static Completable merge0(@NonNull Publisher<@NonNull ? extends Completa
@SafeVarargs
public static Completable mergeArrayDelayError(@NonNull CompletableSource... sources) {
Objects.requireNonNull(sources, "sources is null");
- return RxJavaPlugins.onAssembly(new CompletableMergeDelayErrorArray(sources));
+ return RxJavaPlugins.onAssembly(new CompletableMergeArrayDelayError(sources));
}
/**
@@ -874,7 +996,7 @@ public static Completable mergeArrayDelayError(@NonNull CompletableSource... sou
* any error emitted by any of the inner {@code CompletableSource}s until all of
* them terminate in a way or another.
*
- *
+ *
*
*
Scheduler:
*
{@code mergeDelayError} does not operate by default on a particular {@link Scheduler}.
@@ -935,6 +1057,7 @@ public static Completable mergeDelayError(@NonNull Publisher<@NonNull ? extends
* at a time to the inner {@code CompletableSource}s
* @return the new {@code Completable} instance
* @throws NullPointerException if {@code sources} is {@code null}
+ * @throws IllegalArgumentException if {@code maxConcurrency} is non-positive
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@@ -1008,7 +1131,7 @@ public static Completable timer(long delay, @NonNull TimeUnit unit, @NonNull Sch
/**
* Creates a {@link NullPointerException} instance and sets the given {@link Throwable} as its initial cause.
* @param ex the {@code Throwable} instance to use as cause, not {@code null} (not verified)
- * @return the created {@code NullPointerException}
+ * @return the new {@code NullPointerException}
*/
private static NullPointerException toNpe(Throwable ex) {
NullPointerException npe = new NullPointerException("Actually not, but can't pass out an exception otherwise...");
@@ -1016,11 +1139,76 @@ private static NullPointerException toNpe(Throwable ex) {
return npe;
}
+ /**
+ * Switches between {@link CompletableSource}s emitted by the source {@link Publisher} whenever
+ * a new {@code CompletableSource} is emitted, disposing the previously running {@code CompletableSource},
+ * exposing the setup as a {@code Completable} sequence.
+ *
+ *
+ *
+ *
Backpressure:
+ *
The {@code sources} {@code Publisher} is consumed in an unbounded manner (requesting {@link Long#MAX_VALUE}).
+ *
Scheduler:
+ *
{@code switchOnNext} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
The returned sequence fails with the first error signaled by the {@code sources} {@code Publisher}
+ * or the currently running {@code CompletableSource}, disposing the rest. Late errors are
+ * forwarded to the global error handler via {@link RxJavaPlugins#onError(Throwable)}.
+ *
+ * @param sources the {@code Publisher} sequence of inner {@code CompletableSource}s to switch between
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code sources} is {@code null}
+ * @since 3.0.0
+ * @see #switchOnNextDelayError(Publisher)
+ * @see ReactiveX operators documentation: Switch
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
+ public static Completable switchOnNext(@NonNull Publisher<@NonNull ? extends CompletableSource> sources) {
+ Objects.requireNonNull(sources, "sources is null");
+ return RxJavaPlugins.onAssembly(new FlowableSwitchMapCompletablePublisher<>(sources, Functions.identity(), false));
+ }
+
+ /**
+ * Switches between {@link CompletableSource}s emitted by the source {@link Publisher} whenever
+ * a new {@code CompletableSource} is emitted, disposing the previously running {@code CompletableSource},
+ * exposing the setup as a {@code Completable} sequence and delaying all errors from
+ * all of them until all terminate.
+ *
+ *
+ *
+ *
Backpressure:
+ *
The {@code sources} {@code Publisher} is consumed in an unbounded manner (requesting {@link Long#MAX_VALUE}).
+ *
Scheduler:
+ *
{@code switchOnNextDelayError} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
The returned {@code Completable} collects all errors emitted by either the {@code sources}
+ * {@code Publisher} or any inner {@code CompletableSource} and emits them as a {@link CompositeException}
+ * when all sources terminate. If only one source ever failed, its error is emitted as-is at the end.
+ *
+ * @param sources the {@code Publisher} sequence of inner {@code CompletableSource}s to switch between
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code sources} is {@code null}
+ * @since 3.0.0
+ * @see #switchOnNext(Publisher)
+ * @see ReactiveX operators documentation: Switch
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
+ public static Completable switchOnNextDelayError(@NonNull Publisher<@NonNull ? extends CompletableSource> sources) {
+ Objects.requireNonNull(sources, "sources is null");
+ return RxJavaPlugins.onAssembly(new FlowableSwitchMapCompletablePublisher<>(sources, Functions.identity(), true));
+ }
+
/**
* Returns a {@code Completable} instance which manages a resource along
* with a custom {@link CompletableSource} instance while the subscription is active.
*
- *
+ *
*
* This overload disposes eagerly before the terminal event is emitted.
*
* @param the resource type
* @param resourceSupplier the {@link Supplier} that returns a resource to be managed.
- * @param completableFunction the {@link Function} that given a resource returns a {@code CompletableSource} instance that will be subscribed to
- * @param disposer the {@link Consumer} that disposes the resource created by the resource supplier
+ * @param sourceSupplier the {@link Function} that given a resource returns a {@code CompletableSource} instance that will be subscribed to
+ * @param resourceCleanup the {@link Consumer} that disposes the resource created by the resource supplier
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code resourceSupplier}, {@code completableFunction}
- * or {@code disposer} is {@code null}
+ * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier}
+ * or {@code resourceCleanup} is {@code null}
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public static Completable using(@NonNull Supplier resourceSupplier,
- @NonNull Function super R, ? extends CompletableSource> completableFunction,
- @NonNull Consumer super R> disposer) {
- return using(resourceSupplier, completableFunction, disposer, true);
+ public static <@NonNull R> Completable using(@NonNull Supplier resourceSupplier,
+ @NonNull Function super R, ? extends CompletableSource> sourceSupplier,
+ @NonNull Consumer super R> resourceCleanup) {
+ return using(resourceSupplier, sourceSupplier, resourceCleanup, true);
}
/**
@@ -1059,31 +1247,31 @@ public static Completable using(@NonNull Supplier resourceSupplier,
*
* @param the resource type
* @param resourceSupplier the {@link Supplier} that returns a resource to be managed
- * @param completableFunction the {@link Function} that given a resource returns a non-{@code null}
+ * @param sourceSupplier the {@link Function} that given a resource returns a non-{@code null}
* {@code CompletableSource} instance that will be subscribed to
- * @param disposer the {@link Consumer} that disposes the resource created by the resource supplier
+ * @param resourceCleanup the {@link Consumer} that disposes the resource created by the resource supplier
* @param eager
* If {@code true} then resource disposal will happen either on a {@code dispose()} call before the upstream is disposed
* or just before the emission of a terminal event ({@code onComplete} or {@code onError}).
* If {@code false} the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed
* or just after the emission of a terminal event ({@code onComplete} or {@code onError}).
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code resourceSupplier}, {@code completableFunction}
- * or {@code disposer} is {@code null}
+ * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier}
+ * or {@code resourceCleanup} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public static Completable using(
+ public static <@NonNull R> Completable using(
@NonNull Supplier resourceSupplier,
- @NonNull Function super R, ? extends CompletableSource> completableFunction,
- @NonNull Consumer super R> disposer,
+ @NonNull Function super R, ? extends CompletableSource> sourceSupplier,
+ @NonNull Consumer super R> resourceCleanup,
boolean eager) {
Objects.requireNonNull(resourceSupplier, "resourceSupplier is null");
- Objects.requireNonNull(completableFunction, "completableFunction is null");
- Objects.requireNonNull(disposer, "disposer is null");
+ Objects.requireNonNull(sourceSupplier, "sourceSupplier is null");
+ Objects.requireNonNull(resourceCleanup, "resourceCleanup is null");
- return RxJavaPlugins.onAssembly(new CompletableUsing<>(resourceSupplier, completableFunction, disposer, eager));
+ return RxJavaPlugins.onAssembly(new CompletableUsing<>(resourceSupplier, sourceSupplier, resourceCleanup, eager));
}
/**
@@ -1096,7 +1284,7 @@ public static Completable using(
*
{@code wrap} does not operate by default on a particular {@link Scheduler}.
*
* @param source the source to wrap
- * @return the source or its wrapper {@code Completable}
+ * @return the new wrapped or cast {@code Completable} instance
* @throws NullPointerException if {@code source} is {@code null}
*/
@CheckReturnValue
@@ -1114,7 +1302,7 @@ public static Completable wrap(@NonNull CompletableSource source) {
* Returns a {@code Completable} that emits the a terminated event of either this {@code Completable}
* or the other {@link CompletableSource}, whichever fires first.
*
- *
+ *
*
*
Scheduler:
*
{@code ambWith} does not operate by default on a particular {@link Scheduler}.
@@ -1215,7 +1403,7 @@ public final Completable ambWith(@NonNull CompletableSource other) {
* propagated to the downstream observer and will result in skipping the subscription to the next
* {@code MaybeSource}.
*
- *
+ *
*
*
Scheduler:
*
{@code andThen} does not operate by default on a particular {@link Scheduler}.
@@ -1263,7 +1451,7 @@ public final Completable andThen(@NonNull CompletableSource next) {
* Subscribes to and awaits the termination of this {@code Completable} instance in a blocking manner and
* rethrows any exception emitted.
*
- *
+ *
*
*
Scheduler:
*
{@code blockingAwait} does not operate by default on a particular {@link Scheduler}.
@@ -1310,6 +1498,106 @@ public final boolean blockingAwait(long timeout, @NonNull TimeUnit unit) {
return observer.blockingAwait(timeout, unit);
}
+ /**
+ * Subscribes to the current {@code Completable} and blocks the current thread until it terminates.
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code blockingSubscribe} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
If the current {@code Completable} signals an error,
+ * the {@link Throwable} is routed to the global error handler via {@link RxJavaPlugins#onError(Throwable)}.
+ * If the current thread is interrupted, an {@link InterruptedException} is routed to the same global error handler.
+ *
+ *
+ * @since 3.0.0
+ * @see #blockingSubscribe(Action)
+ * @see #blockingSubscribe(Action, Consumer)
+ */
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public final void blockingSubscribe() {
+ blockingSubscribe(Functions.EMPTY_ACTION, Functions.ERROR_CONSUMER);
+ }
+
+ /**
+ * Subscribes to the current {@code Completable} and calls given {@code onComplete} callback on the current thread
+ * when it completes normally.
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code blockingSubscribe} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
If either the current {@code Completable} signals an error or {@code onComplete} throws,
+ * the respective {@link Throwable} is routed to the global error handler via {@link RxJavaPlugins#onError(Throwable)}.
+ * If the current thread is interrupted, an {@link InterruptedException} is routed to the same global error handler.
+ *
+ *
+ * @param onComplete the {@link Action} to call if the current {@code Completable} completes normally
+ * @throws NullPointerException if {@code onComplete} is {@code null}
+ * @since 3.0.0
+ * @see #blockingSubscribe(Action, Consumer)
+ */
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public final void blockingSubscribe(@NonNull Action onComplete) {
+ blockingSubscribe(onComplete, Functions.ERROR_CONSUMER);
+ }
+
+ /**
+ * Subscribes to the current {@code Completable} and calls the appropriate callback on the current thread
+ * when it terminates.
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code blockingSubscribe} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
If either {@code onComplete} or {@code onError} throw, the {@link Throwable} is routed to the
+ * global error handler via {@link RxJavaPlugins#onError(Throwable)}.
+ * If the current thread is interrupted, the {@code onError} consumer is called with an {@link InterruptedException}.
+ *
+ *
+ * @param onComplete the {@link Action} to call if the current {@code Completable} completes normally
+ * @param onError the {@link Consumer} to call if the current {@code Completable} signals an error
+ * @throws NullPointerException if {@code onComplete} or {@code onError} is {@code null}
+ * @since 3.0.0
+ */
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public final void blockingSubscribe(@NonNull Action onComplete, @NonNull Consumer super Throwable> onError) {
+ Objects.requireNonNull(onComplete, "onComplete is null");
+ Objects.requireNonNull(onError, "onError is null");
+ BlockingMultiObserver observer = new BlockingMultiObserver<>();
+ subscribe(observer);
+ observer.blockingConsume(Functions.emptyConsumer(), onError, onComplete);
+ }
+
+ /**
+ * Subscribes to the current {@code Completable} and calls the appropriate {@link CompletableObserver} method on the current thread.
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code blockingSubscribe} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
An {@code onError} signal is delivered to the {@link CompletableObserver#onError(Throwable)} method.
+ * If any of the {@code CompletableObserver}'s methods throw, the {@link RuntimeException} is propagated to the caller of this method.
+ * If the current thread is interrupted, an {@link InterruptedException} is delivered to {@code observer.onError}.
+ *
+ *
+ * @param observer the {@code CompletableObserver} to call methods on the current thread
+ * @throws NullPointerException if {@code observer} is {@code null}
+ * @since 3.0.0
+ */
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public final void blockingSubscribe(@NonNull CompletableObserver observer) {
+ Objects.requireNonNull(observer, "observer is null");
+ BlockingDisposableMultiObserver blockingObserver = new BlockingDisposableMultiObserver<>();
+ observer.onSubscribe(blockingObserver);
+ subscribe(blockingObserver);
+ blockingObserver.blockingConsume(observer);
+ }
+
/**
* Subscribes to this {@code Completable} only once, when the first {@link CompletableObserver}
* subscribes to the result {@code Completable}, caches its terminal event
@@ -1344,7 +1632,7 @@ public final Completable cache() {
*
{@code compose} does not operate by default on a particular {@link Scheduler}.
*
* @param transformer the transformer function, not {@code null}
- * @return a {@code Completable} wrapping the {@code CompletableSource} returned by the function via {@link #wrap(CompletableSource)}
+ * @return the new {@code Completable} instance
* @throws NullPointerException if {@code transformer} is {@code null}
*/
@CheckReturnValue
@@ -1385,12 +1673,12 @@ public final Completable concatWith(@NonNull CompletableSource other) {
/**
* Returns a {@code Completable} which delays the emission of the completion event by the given time.
*
- *
+ *
*
*
Scheduler:
*
{@code delay} does operate by default on the {@code computation} {@link Scheduler}.
*
- * @param delay the delay time
+ * @param time the delay time
* @param unit the delay unit
* @return the new {@code Completable} instance
* @throws NullPointerException if {@code unit} is {@code null}
@@ -1398,8 +1686,8 @@ public final Completable concatWith(@NonNull CompletableSource other) {
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.COMPUTATION)
@NonNull
- public final Completable delay(long delay, @NonNull TimeUnit unit) {
- return delay(delay, unit, Schedulers.computation(), false);
+ public final Completable delay(long time, @NonNull TimeUnit unit) {
+ return delay(time, unit, Schedulers.computation(), false);
}
/**
@@ -1411,7 +1699,7 @@ public final Completable delay(long delay, @NonNull TimeUnit unit) {
*
Scheduler:
*
{@code delay} operates on the {@code Scheduler} you specify.
*
- * @param delay the delay time
+ * @param time the delay time
* @param unit the delay unit
* @param scheduler the {@code Scheduler} to run the delayed completion on
* @return the new {@code Completable} instance
@@ -1420,8 +1708,8 @@ public final Completable delay(long delay, @NonNull TimeUnit unit) {
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
@NonNull
- public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
- return delay(delay, unit, scheduler, false);
+ public final Completable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
+ return delay(time, unit, scheduler, false);
}
/**
@@ -1433,7 +1721,7 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
*
Scheduler:
*
{@code delay} operates on the {@code Scheduler} you specify.
*
- * @param delay the delay time
+ * @param time the delay time
* @param unit the delay unit
* @param scheduler the {@code Scheduler} to run the delayed completion on
* @param delayError delay the error emission as well?
@@ -1443,10 +1731,10 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.CUSTOM)
- public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
+ public final Completable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
Objects.requireNonNull(unit, "unit is null");
Objects.requireNonNull(scheduler, "scheduler is null");
- return RxJavaPlugins.onAssembly(new CompletableDelay(this, delay, unit, scheduler, delayError));
+ return RxJavaPlugins.onAssembly(new CompletableDelay(this, time, unit, scheduler, delayError));
}
/**
@@ -1459,9 +1747,9 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
*
*
History: 2.2.3 - experimental
*
- * @param delay the time to delay the subscription
+ * @param time the time to delay the subscription
* @param unit the time unit of {@code delay}
- * @return a {@code Completable} that delays the subscription to the upstream by the given amount
+ * @return the new {@code Completable} instance
* @throws NullPointerException if {@code unit} is {@code null}
* @since 3.0.0
* @see ReactiveX operators documentation: Delay
@@ -1469,8 +1757,8 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.COMPUTATION)
@NonNull
- public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) {
- return delaySubscription(delay, unit, Schedulers.computation());
+ public final Completable delaySubscription(long time, @NonNull TimeUnit unit) {
+ return delaySubscription(time, unit, Schedulers.computation());
}
/**
@@ -1483,11 +1771,10 @@ public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) {
*
You specify which {@code Scheduler} this operator will use.
*
*
History: 2.2.3 - experimental
- * @param delay the time to delay the subscription
+ * @param time the time to delay the subscription
* @param unit the time unit of {@code delay}
* @param scheduler the {@code Scheduler} on which the waiting and subscription will happen
- * @return a {@code Completable} that delays the subscription to the upstream by a given
- * amount of time, waiting and subscribing on the given {@code Scheduler}
+ * @return the new {@code Completable} instance
* @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
* @since 3.0.0
* @see ReactiveX operators documentation: Delay
@@ -1495,8 +1782,8 @@ public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) {
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
@NonNull
- public final Completable delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
- return Completable.timer(delay, unit, scheduler).andThen(this);
+ public final Completable delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
+ return Completable.timer(time, unit, scheduler).andThen(this);
}
/**
@@ -1587,6 +1874,34 @@ public final Completable doOnEvent(@NonNull Consumer<@Nullable ? super Throwable
return RxJavaPlugins.onAssembly(new CompletableDoOnEvent(this, onEvent));
}
+ /**
+ * Calls the appropriate {@code onXXX} method (shared between all {@link CompletableObserver}s) for the lifecycle events of
+ * the sequence (subscription, disposal).
+ *
+ *
+ *
+ *
Scheduler:
+ *
{@code doOnLifecycle} does not operate by default on a particular {@link Scheduler}.
+ *
+ *
+ * @param onSubscribe
+ * a {@link Consumer} called with the {@link Disposable} sent via {@link CompletableObserver#onSubscribe(Disposable)}
+ * @param onDispose
+ * called when the downstream disposes the {@code Disposable} via {@code dispose()}
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code onSubscribe} or {@code onDispose} is {@code null}
+ * @see ReactiveX operators documentation: Do
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @SchedulerSupport(SchedulerSupport.NONE)
+ @NonNull
+ public final Completable doOnLifecycle(@NonNull Consumer super Disposable> onSubscribe, @NonNull Action onDispose) {
+ return doOnLifecycle(onSubscribe, Functions.emptyConsumer(),
+ Functions.EMPTY_ACTION, Functions.EMPTY_ACTION,
+ Functions.EMPTY_ACTION, onDispose);
+ }
+
/**
* Returns a {@code Completable} instance that calls the various callbacks upon the specific
* lifecycle events.
@@ -1594,11 +1909,12 @@ public final Completable doOnEvent(@NonNull Consumer<@Nullable ? super Throwable
*
Scheduler:
*
{@code doOnLifecycle} does not operate by default on a particular {@link Scheduler}.
*
- * @param onSubscribe the consumer called when a {@link CompletableObserver} subscribes.
- * @param onError the consumer called when this emits an {@code onError} event
- * @param onComplete the runnable called just before when the current {@code Completable} completes normally
- * @param onAfterTerminate the runnable called after this {@code Completable} completes normally
- * @param onDispose the {@link Runnable} called when the downstream disposes the subscription
+ * @param onSubscribe the {@link Consumer} called when a {@link CompletableObserver} subscribes.
+ * @param onError the {@code Consumer} called when this emits an {@code onError} event
+ * @param onComplete the {@link Action} called just before when the current {@code Completable} completes normally
+ * @param onTerminate the {@code Action} called just before this {@code Completable} terminates
+ * @param onAfterTerminate the {@code Action} called after this {@code Completable} completes normally
+ * @param onDispose the {@code Action} called when the downstream disposes the subscription
* @return the new {@code Completable} instance
* @throws NullPointerException if {@code onSubscribe}, {@code onError}, {@code onComplete}
* {@code onTerminate}, {@code onAfterTerminate} or {@code onDispose} is {@code null}
@@ -1648,7 +1964,7 @@ public final Completable doOnSubscribe(@NonNull Consumer super Disposable> onS
* Returns a {@code Completable} instance that calls the given {@code onTerminate} {@link Action} just before this {@code Completable}
* completes normally or with an exception.
*
- *
+ *
*
*
Scheduler:
*
{@code doOnTerminate} does not operate by default on a particular {@link Scheduler}.
@@ -1671,7 +1987,7 @@ public final Completable doOnTerminate(@NonNull Action onTerminate) {
* Returns a {@code Completable} instance that calls the given {@code onAfterTerminate} {@link Action} after this {@code Completable}
* completes normally or with an exception.
*
- *
+ *
*
*
Scheduler:
*
{@code doAfterTerminate} does not operate by default on a particular {@link Scheduler}.
@@ -1865,7 +2181,7 @@ public final Completable lift(@NonNull CompletableOperator onLift) {
* Maps the signal types of this {@code Completable} into a {@link Notification} of the same kind
* and emits it as a single success value to downstream.
*
- *
+ *
*
*
Scheduler:
*
{@code materialize} does not operate by default on a particular {@link Scheduler}.
@@ -1879,7 +2195,7 @@ public final Completable lift(@NonNull CompletableOperator onLift) {
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public final Single> materialize() {
+ public final <@NonNull T> Single> materialize() {
return RxJavaPlugins.onAssembly(new CompletableMaterialize<>(this));
}
@@ -1975,17 +2291,103 @@ public final Completable onErrorComplete(@NonNull Predicate super Throwable> p
*
Scheduler:
*
{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.
*
- * @param errorMapper the {@code mapper} {@code Function} that takes the error and should return a {@code CompletableSource} as
+ * @param fallbackSupplier the {@code mapper} {@code Function} that takes the error and should return a {@code CompletableSource} as
* continuation.
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code errorMapper} is {@code null}
+ * @throws NullPointerException if {@code fallbackSupplier} is {@code null}
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public final Completable onErrorResumeNext(@NonNull Function super Throwable, ? extends CompletableSource> fallbackSupplier) {
+ Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null");
+ return RxJavaPlugins.onAssembly(new CompletableResumeNext(this, fallbackSupplier));
+ }
+ /**
+ * Resumes the flow with the given {@link CompletableSource} when the current {@code Completable} fails instead of
+ * signaling the error via {@code onError}.
+ *
+ *
+ *
+ * You can use this to prevent errors from propagating or to supply fallback data should errors be
+ * encountered.
+ *
+ *
Scheduler:
+ *
{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}.
+ *
+ *
+ * @param fallback
+ * the next {@code CompletableSource} that will take over if the current {@code Completable} encounters
+ * an error
+ * @return the new {@code Completable} instance
+ * @throws NullPointerException if {@code fallback} is {@code null}
+ * @see ReactiveX operators documentation: Catch
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public final Completable onErrorResumeWith(@NonNull CompletableSource fallback) {
+ Objects.requireNonNull(fallback, "fallback is null");
+ return onErrorResumeNext(Functions.justFunction(fallback));
+ }
+
+ /**
+ * Ends the flow with a success item returned by a function for the {@link Throwable} error signaled by the current
+ * {@code Completable} instead of signaling the error via {@code onError}.
+ *
+ *
+ *
+ * You can use this to prevent errors from propagating or to supply fallback data should errors be
+ * encountered.
+ *
+ *
Scheduler:
+ *
{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.
+ *
+ *
+ * @param the item type to return on error
+ * @param itemSupplier
+ * a function that returns a single value that will be emitted as success value
+ * the current {@code Completable} signals an {@code onError} event
+ * @return the new {@link Maybe} instance
+ * @throws NullPointerException if {@code itemSupplier} is {@code null}
+ * @see ReactiveX operators documentation: Catch
+ * @since 3.0.0
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
- public final Completable onErrorResumeNext(@NonNull Function super Throwable, ? extends CompletableSource> errorMapper) {
- Objects.requireNonNull(errorMapper, "errorMapper is null");
- return RxJavaPlugins.onAssembly(new CompletableResumeNext(this, errorMapper));
+ public final <@NonNull T> Maybe onErrorReturn(@NonNull Function super Throwable, ? extends T> itemSupplier) {
+ Objects.requireNonNull(itemSupplier, "itemSupplier is null");
+ return RxJavaPlugins.onAssembly(new CompletableOnErrorReturn<>(this, itemSupplier));
+ }
+
+ /**
+ * Ends the flow with the given success item when the current {@code Completable}
+ * fails instead of signaling the error via {@code onError}.
+ *
+ *
+ *
+ * You can use this to prevent errors from propagating or to supply fallback data should errors be
+ * encountered.
+ *
+ *
Scheduler:
+ *
{@code onErrorReturnItem} does not operate by default on a particular {@link Scheduler}.
+ *
+ *
+ * @param the item type to return on error
+ * @param item
+ * the value that is emitted as {@code onSuccess} in case the current {@code Completable} signals an {@code onError}
+ * @return the new {@link Maybe} instance
+ * @throws NullPointerException if {@code item} is {@code null}
+ * @see ReactiveX operators documentation: Catch
+ */
+ @CheckReturnValue
+ @NonNull
+ @SchedulerSupport(SchedulerSupport.NONE)
+ public final <@NonNull T> Maybe onErrorReturnItem(@NonNull T item) {
+ Objects.requireNonNull(item, "item is null");
+ return onErrorReturn(Functions.justFunction(item));
}
/**
@@ -1998,8 +2400,7 @@ public final Completable onErrorResumeNext(@NonNull Function super Throwable,
*
{@code onTerminateDetach} does not operate by default on a particular {@link Scheduler}.
*
*
History: 2.1.5 - experimental
- * @return a {@code Completable} which {@code null}s out references to the upstream producer and downstream {@code CompletableObserver} if
- * the sequence is terminated or downstream calls {@code dispose()}
+ * @return the new {@code Completable} instance
* @since 2.2
*/
@CheckReturnValue
@@ -2083,7 +2484,7 @@ public final Completable repeatUntil(@NonNull BooleanSupplier stop) {
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public final Completable repeatWhen(@NonNull Function super Flowable
* @param timeout the timeout value
* @param unit the unit of {@code timeout}
- * @param other the other {@code CompletableSource} instance to switch to in case of a timeout
+ * @param fallback the other {@code CompletableSource} instance to switch to in case of a timeout
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code unit} or {@code other} is {@code null}
+ * @throws NullPointerException if {@code unit} or {@code fallback} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.COMPUTATION)
- public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull CompletableSource other) {
- Objects.requireNonNull(other, "other is null");
- return timeout0(timeout, unit, Schedulers.computation(), other);
+ public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull CompletableSource fallback) {
+ Objects.requireNonNull(fallback, "fallback is null");
+ return timeout0(timeout, unit, Schedulers.computation(), fallback);
}
/**
@@ -2595,16 +3132,16 @@ public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull
* @param timeout the timeout value
* @param unit the unit of {@code timeout}
* @param scheduler the {@code Scheduler} to use to wait for completion
- * @param other the other {@code Completable} instance to switch to in case of a timeout
+ * @param fallback the other {@code Completable} instance to switch to in case of a timeout
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null}
+ * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.CUSTOM)
- public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull CompletableSource other) {
- Objects.requireNonNull(other, "other is null");
- return timeout0(timeout, unit, scheduler, other);
+ public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull CompletableSource fallback) {
+ Objects.requireNonNull(fallback, "fallback is null");
+ return timeout0(timeout, unit, scheduler, fallback);
}
/**
@@ -2618,18 +3155,18 @@ public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull
* @param timeout the timeout value
* @param unit the unit of {@code timeout}
* @param scheduler the {@code Scheduler} to use to wait for completion
- * @param other the other {@code Completable} instance to switch to in case of a timeout,
+ * @param fallback the other {@code Completable} instance to switch to in case of a timeout,
* if {@code null} a {@link TimeoutException} is emitted instead
* @return the new {@code Completable} instance
- * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null}
+ * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null}
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.CUSTOM)
- private Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableSource other) {
+ private Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableSource fallback) {
Objects.requireNonNull(unit, "unit is null");
Objects.requireNonNull(scheduler, "scheduler is null");
- return RxJavaPlugins.onAssembly(new CompletableTimeout(this, timeout, unit, scheduler, other));
+ return RxJavaPlugins.onAssembly(new CompletableTimeout(this, timeout, unit, scheduler, fallback));
}
/**
@@ -2674,12 +3211,34 @@ public final R to(@NonNull CompletableConverter extends R> converter) {
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public final Flowable toFlowable() {
+ public final <@NonNull T> Flowable toFlowable() {
if (this instanceof FuseToFlowable) {
return ((FuseToFlowable)this).fuseToFlowable();
}
return RxJavaPlugins.onAssembly(new CompletableToFlowable<>(this));
}
+ /**
+ * Returns a {@link Future} representing the termination of the current {@code Completable}
+ * via a {@code null} value.
+ *
+ *
+ *
+ * Cancelling the {@code Future} will cancel the subscription to the current {@code Completable}.
+ *
+ *
Scheduler:
+ *
{@code toFuture} does not operate by default on a particular {@link Scheduler}.
+ *
+ *
+ * @return the new {@code Future} instance
+ * @see ReactiveX documentation: To
+ * @since 3.0.0
+ */
+ @CheckReturnValue
+ @SchedulerSupport(SchedulerSupport.NONE)
+ @NonNull
+ public final Future toFuture() {
+ return subscribeWith(new FutureMultiObserver<>());
+ }
/**
* Converts this {@code Completable} into a {@link Maybe}.
@@ -2691,14 +3250,13 @@ public final Flowable toFlowable() {
*
*
* @param the value type
- * @return a {@code Maybe} that only calls {@code onComplete} or {@code onError}, based on which one is
- * called by the current {@code Completable}.
+ * @return the new {@code Maybe} instance
*/
@CheckReturnValue
@SuppressWarnings("unchecked")
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public final Maybe toMaybe() {
+ public final <@NonNull T> Maybe toMaybe() {
if (this instanceof FuseToMaybe) {
return ((FuseToMaybe)this).fuseToMaybe();
}
@@ -2721,7 +3279,7 @@ public final Maybe toMaybe() {
@SuppressWarnings("unchecked")
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public final Observable toObservable() {
+ public final <@NonNull T> Observable toObservable() {
if (this instanceof FuseToObservable) {
return ((FuseToObservable)this).fuseToObservable();
}
@@ -2853,7 +3411,7 @@ public final TestObserver test(boolean dispose) {
*
*
* Note that the operator takes an already instantiated, running or terminated {@code CompletionStage}.
- * If the optional is to be created per consumer upon subscription, use {@link #defer(Supplier)}
+ * If the {@code CompletionStage} is to be created per consumer upon subscription, use {@link #defer(Supplier)}
* around {@code fromCompletionStage}:
*
* Maybe.defer(() -> Completable.fromCompletionStage(createCompletionStage()));
@@ -2908,7 +3466,7 @@ public static Completable fromCompletionStage(@NonNull CompletionStage> stage)
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public final CompletionStage toCompletionStage(@Nullable T defaultItem) {
+ public final <@Nullable T> CompletionStage toCompletionStage(T defaultItem) {
return subscribeWith(new CompletionStageConsumer<>(true, defaultItem));
}
}
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java b/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java
index 83e8f693eb..a213c6f5ab 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableConverter.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java b/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java
index 5ebb4e1877..2c5a9811c4 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableEmitter.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java b/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java
index 7c01ebfee1..9339307047 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableObserver.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java
index 70d79e62b6..e73fae2d5c 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableOnSubscribe.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,13 +10,14 @@
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
+
package io.reactivex.rxjava3.core;
import io.reactivex.rxjava3.annotations.NonNull;
/**
* A functional interface that has a {@code subscribe()} method that receives
- * an instance of a {@link CompletableEmitter} instance that allows pushing
+ * a {@link CompletableEmitter} instance that allows pushing
* an event in a cancellation-safe manner.
*/
@FunctionalInterface
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java b/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java
index e9b1df83cb..f06a94f36a 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableOperator.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java b/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java
index 58edf9471c..90d3853b8a 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableSource.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
+
package io.reactivex.rxjava3.core;
import io.reactivex.rxjava3.annotations.NonNull;
diff --git a/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java b/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java
index 98a9e2aa19..2887c4717c 100644
--- a/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java
+++ b/src/main/java/io/reactivex/rxjava3/core/CompletableTransformer.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
diff --git a/src/main/java/io/reactivex/rxjava3/core/Emitter.java b/src/main/java/io/reactivex/rxjava3/core/Emitter.java
index e9ea2a1827..83410f056e 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Emitter.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Emitter.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
+
package io.reactivex.rxjava3.core;
import io.reactivex.rxjava3.annotations.NonNull;
diff --git a/src/main/java/io/reactivex/rxjava3/core/Flowable.java b/src/main/java/io/reactivex/rxjava3/core/Flowable.java
index c1f4338cd2..39f3c63b43 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Flowable.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Flowable.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
@@ -10,6 +10,7 @@
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
+
package io.reactivex.rxjava3.core;
import java.util.*;
@@ -19,19 +20,21 @@
import org.reactivestreams.*;
import io.reactivex.rxjava3.annotations.*;
-import io.reactivex.rxjava3.disposables.Disposable;
+import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.flowables.*;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.internal.functions.*;
-import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier;
import io.reactivex.rxjava3.internal.jdk8.*;
import io.reactivex.rxjava3.internal.operators.flowable.*;
+import io.reactivex.rxjava3.internal.operators.maybe.MaybeToFlowable;
import io.reactivex.rxjava3.internal.operators.mixed.*;
import io.reactivex.rxjava3.internal.operators.observable.ObservableFromPublisher;
+import io.reactivex.rxjava3.internal.operators.single.SingleToFlowable;
import io.reactivex.rxjava3.internal.schedulers.ImmediateThinScheduler;
import io.reactivex.rxjava3.internal.subscribers.*;
import io.reactivex.rxjava3.internal.util.*;
+import io.reactivex.rxjava3.operators.ScalarSupplier;
import io.reactivex.rxjava3.parallel.ParallelFlowable;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.schedulers.*;
@@ -51,7 +54,7 @@
*
* The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:
*
- *
+ *
*
* The {@code Flowable} follows the protocol
*
@@ -161,21 +164,28 @@ public abstract class Flowable<@NonNull T> implements Publisher {
* Mirrors the one {@link Publisher} in an {@link Iterable} of several {@code Publisher}s that first either emits an item or sends
* a termination notification.
*
- *
+ *
+ *
+ * When one of the {@code Publisher}s signal an item or terminates first, all subscriptions to the other
+ * {@code Publisher}s are canceled.
*
*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by the winning
* {@code Publisher}'s backpressure behavior.
*
Scheduler:
*
{@code amb} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If any of the losing {@code Publisher}s signals an error, the error is routed to the global
+ * error handler via {@link RxJavaPlugins#onError(Throwable)}.
+ *
*
*
* @param the common element type
* @param sources
* an {@code Iterable} of {@code Publisher}s sources competing to react first. A subscription to each {@code Publisher} will
* occur in the same order as in this {@code Iterable}.
- * @return a {@code Flowable} that emits the same sequence as whichever of the source {@code Publisher}s first
- * emitted an item or sent a termination notification
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} is {@code null}
* @see ReactiveX operators documentation: Amb
*/
@@ -183,7 +193,7 @@ public abstract class Flowable<@NonNull T> implements Publisher {
@NonNull
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) {
+ public static <@NonNull T> Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher extends T>> sources) {
Objects.requireNonNull(sources, "sources is null");
return RxJavaPlugins.onAssembly(new FlowableAmb<>(null, sources));
}
@@ -192,21 +202,28 @@ public static Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher
* Mirrors the one {@link Publisher} in an array of several {@code Publisher}s that first either emits an item or sends
* a termination notification.
*
- *
+ *
+ *
+ * When one of the {@code Publisher}s signal an item or terminates first, all subscriptions to the other
+ * {@code Publisher}s are canceled.
*
*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by the winning
* {@code Publisher}'s backpressure behavior.
*
Scheduler:
*
{@code ambArray} does not operate by default on a particular {@link Scheduler}.
+ *
Error handling:
+ *
+ * If any of the losing {@code Publisher}s signals an error, the error is routed to the global
+ * error handler via {@link RxJavaPlugins#onError(Throwable)}.
+ *
*
*
* @param the common element type
* @param sources
* an array of {@code Publisher} sources competing to react first. A subscription to each {@code Publisher} will
* occur in the same order as in this array.
- * @return a {@code Flowable} that emits the same sequence as whichever of the source {@code Publisher}s first
- * emitted an item or sent a termination notification
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} is {@code null}
* @see ReactiveX operators documentation: Amb
*/
@@ -215,7 +232,7 @@ public static Flowable amb(@NonNull Iterable<@NonNull ? extends Publisher
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
@SchedulerSupport(SchedulerSupport.NONE)
@SafeVarargs
- public static Flowable ambArray(Publisher<@NonNull ? extends T>... sources) {
+ public static <@NonNull T> Flowable ambArray(@NonNull Publisher extends T>... sources) {
Objects.requireNonNull(sources, "sources is null");
int len = sources.length;
if (len == 0) {
@@ -271,8 +288,7 @@ public static int bufferSize() {
* the collection of source {@code Publisher}s
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
*/
@@ -280,7 +296,7 @@ public static int bufferSize() {
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@NonNull
- public static Flowable combineLatestArray(@NonNull Publisher<@NonNull ? extends T>[] sources, @NonNull Function super Object[], ? extends R> combiner) {
+ public static <@NonNull T, @NonNull R> Flowable combineLatestArray(@NonNull Publisher extends T>[] sources, @NonNull Function super Object[], ? extends R> combiner) {
return combineLatestArray(sources, combiner, bufferSize());
}
@@ -319,8 +335,7 @@ public static int bufferSize() {
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source {@code Flowable}
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @throws IllegalArgumentException if {@code bufferSize} is non-positive
* @see ReactiveX operators documentation: CombineLatest
@@ -329,7 +344,7 @@ public static int bufferSize() {
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
- public static Flowable combineLatestArray(@NonNull Publisher<@NonNull ? extends T>[] sources, @NonNull Function super Object[], ? extends R> combiner, int bufferSize) {
+ public static <@NonNull T, @NonNull R> Flowable combineLatestArray(@NonNull Publisher extends T>[] sources, @NonNull Function super Object[], ? extends R> combiner, int bufferSize) {
Objects.requireNonNull(sources, "sources is null");
if (sources.length == 0) {
return empty();
@@ -372,8 +387,7 @@ public static Flowable combineLatestArray(@NonNull Publisher<@NonNull
* the collection of source {@code Publisher}s
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
*/
@@ -381,7 +395,7 @@ public static Flowable combineLatestArray(@NonNull Publisher<@NonNull
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@NonNull
- public static Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources,
+ public static <@NonNull T, @NonNull R> Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher extends T>> sources,
@NonNull Function super Object[], ? extends R> combiner) {
return combineLatest(sources, combiner, bufferSize());
}
@@ -421,8 +435,7 @@ public static Flowable combineLatestArray(@NonNull Publisher<@NonNull
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source {@code Flowable}
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @throws IllegalArgumentException if {@code bufferSize} is non-positive
* @see ReactiveX operators documentation: CombineLatest
@@ -431,7 +444,7 @@ public static Flowable combineLatestArray(@NonNull Publisher<@NonNull
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
- public static Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources,
+ public static <@NonNull T, @NonNull R> Flowable combineLatest(@NonNull Iterable<@NonNull ? extends Publisher extends T>> sources,
@NonNull Function super Object[], ? extends R> combiner, int bufferSize) {
Objects.requireNonNull(sources, "sources is null");
Objects.requireNonNull(combiner, "combiner is null");
@@ -472,8 +485,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
* the collection of source {@code Publisher}s
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
*/
@@ -481,7 +493,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@NonNull
- public static Flowable combineLatestArrayDelayError(@NonNull Publisher<@NonNull ? extends T>[] sources,
+ public static <@NonNull T, @NonNull R> Flowable combineLatestArrayDelayError(@NonNull Publisher extends T>[] sources,
@NonNull Function super Object[], ? extends R> combiner) {
return combineLatestArrayDelayError(sources, combiner, bufferSize());
}
@@ -522,8 +534,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source {@code Flowable}
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @throws IllegalArgumentException if {@code bufferSize} is non-positive
* @see ReactiveX operators documentation: CombineLatest
@@ -532,7 +543,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
- public static Flowable combineLatestArrayDelayError(@NonNull Publisher<@NonNull ? extends T>[] sources,
+ public static <@NonNull T, @NonNull R> Flowable combineLatestArrayDelayError(@NonNull Publisher extends T>[] sources,
@NonNull Function super Object[], ? extends R> combiner, int bufferSize) {
Objects.requireNonNull(sources, "sources is null");
Objects.requireNonNull(combiner, "combiner is null");
@@ -577,8 +588,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
* the collection of source {@code Publisher}s
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
*/
@@ -586,7 +596,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@NonNull
- public static Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources,
+ public static <@NonNull T, @NonNull R> Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher extends T>> sources,
@NonNull Function super Object[], ? extends R> combiner) {
return combineLatestDelayError(sources, combiner, bufferSize());
}
@@ -627,8 +637,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source {@code Flowable}
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} or {@code combiner} is {@code null}
* @throws IllegalArgumentException if {@code bufferSize} is non-positive
* @see ReactiveX operators documentation: CombineLatest
@@ -637,7 +646,7 @@ public static Flowable combineLatest(@NonNull Iterable<@NonNull ? exte
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@NonNull
- public static Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources,
+ public static <@NonNull T, @NonNull R> Flowable combineLatestDelayError(@NonNull Iterable<@NonNull ? extends Publisher extends T>> sources,
@NonNull Function super Object[], ? extends R> combiner, int bufferSize) {
Objects.requireNonNull(sources, "sources is null");
Objects.requireNonNull(combiner, "combiner is null");
@@ -654,7 +663,7 @@ public static Flowable combineLatestDelayError(@NonNull Iterable<@NonN
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -673,8 +682,7 @@ public static Flowable combineLatestDelayError(@NonNull Iterable<@NonN
* the second source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
*/
@@ -683,8 +691,8 @@ public static Flowable combineLatestDelayError(@NonNull Iterable<@NonN
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
+ public static <@NonNull T1, @NonNull T2, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
@NonNull BiFunction super T1, ? super T2, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -701,7 +709,7 @@ public static Flowable combineLatest(
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -723,8 +731,7 @@ public static Flowable combineLatest(
* the third source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2}, {@code source3} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
*/
@@ -733,9 +740,9 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
- @NonNull Publisher<@NonNull ? extends T3> source3,
+ public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
+ @NonNull Publisher extends T3> source3,
@NonNull Function3 super T1, ? super T2, ? super T3, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -753,7 +760,7 @@ public static Flowable combineLatest(
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -778,8 +785,7 @@ public static Flowable combineLatest(
* the fourth source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2}, {@code source3},
* {@code source4} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
@@ -789,9 +795,9 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
- @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4,
+ public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
+ @NonNull Publisher extends T3> source3, @NonNull Publisher extends T4> source4,
@NonNull Function4 super T1, ? super T2, ? super T3, ? super T4, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -810,7 +816,7 @@ public static Flowable combineLatest(
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -838,8 +844,7 @@ public static Flowable combineLatest(
* the fifth source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2}, {@code source3},
* {@code source4}, {@code source5} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
@@ -849,10 +854,10 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
- @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4,
- @NonNull Publisher<@NonNull ? extends T5> source5,
+ public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
+ @NonNull Publisher extends T3> source3, @NonNull Publisher extends T4> source4,
+ @NonNull Publisher extends T5> source5,
@NonNull Function5 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -872,7 +877,7 @@ public static Flowable combineLatest(
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -903,8 +908,7 @@ public static Flowable combineLatest(
* the sixth source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2}, {@code source3},
* {@code source4}, {@code source5}, {@code source6} or {@code combiner} is {@code null}
* @see ReactiveX operators documentation: CombineLatest
@@ -914,10 +918,10 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
- @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4,
- @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6,
+ public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
+ @NonNull Publisher extends T3> source3, @NonNull Publisher extends T4> source4,
+ @NonNull Publisher extends T5> source5, @NonNull Publisher extends T6> source6,
@NonNull Function6 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -938,7 +942,7 @@ public static Flowable combineLatest(
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -972,8 +976,7 @@ public static Flowable combineLatest(
* the seventh source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2}, {@code source3},
* {@code source4}, {@code source5}, {@code source6},
* {@code source7} or {@code combiner} is {@code null}
@@ -984,11 +987,11 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
- @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4,
- @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6,
- @NonNull Publisher<@NonNull ? extends T7> source7,
+ public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
+ @NonNull Publisher extends T3> source3, @NonNull Publisher extends T4> source4,
+ @NonNull Publisher extends T5> source5, @NonNull Publisher extends T6> source6,
+ @NonNull Publisher extends T7> source7,
@NonNull Function7 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -1010,7 +1013,7 @@ public static Flowable combineLatest(
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -1047,8 +1050,7 @@ public static Flowable combineLatest(
* the eighth source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2}, {@code source3},
* {@code source4}, {@code source5}, {@code source6},
* {@code source7}, {@code source8} or {@code combiner} is {@code null}
@@ -1059,11 +1061,11 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
- @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4,
- @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6,
- @NonNull Publisher<@NonNull ? extends T7> source7, @NonNull Publisher<@NonNull ? extends T8> source8,
+ public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
+ @NonNull Publisher extends T3> source3, @NonNull Publisher extends T4> source4,
+ @NonNull Publisher extends T5> source5, @NonNull Publisher extends T6> source6,
+ @NonNull Publisher extends T7> source7, @NonNull Publisher extends T8> source8,
@NonNull Function8 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -1086,7 +1088,7 @@ public static Flowable combineLatest(
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
- *
+ *
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
@@ -1126,8 +1128,7 @@ public static Flowable combineLatest(
* the ninth source {@code Publisher}
* @param combiner
* the aggregation function used to combine the items emitted by the source {@code Publisher}s
- * @return a {@code Flowable} that emits items that are the result of combining the items emitted by the source
- * {@code Publisher}s by means of the given aggregation function
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2}, {@code source3},
* {@code source4}, {@code source5}, {@code source6},
* {@code source7}, {@code source8}, {@code source9}
@@ -1139,12 +1140,12 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable combineLatest(
- @NonNull Publisher<@NonNull ? extends T1> source1, @NonNull Publisher<@NonNull ? extends T2> source2,
- @NonNull Publisher<@NonNull ? extends T3> source3, @NonNull Publisher<@NonNull ? extends T4> source4,
- @NonNull Publisher<@NonNull ? extends T5> source5, @NonNull Publisher<@NonNull ? extends T6> source6,
- @NonNull Publisher<@NonNull ? extends T7> source7, @NonNull Publisher<@NonNull ? extends T8> source8,
- @NonNull Publisher<@NonNull ? extends T9> source9,
+ public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> Flowable combineLatest(
+ @NonNull Publisher extends T1> source1, @NonNull Publisher extends T2> source2,
+ @NonNull Publisher extends T3> source3, @NonNull Publisher extends T4> source4,
+ @NonNull Publisher extends T5> source5, @NonNull Publisher extends T6> source6,
+ @NonNull Publisher extends T7> source7, @NonNull Publisher extends T8> source8,
+ @NonNull Publisher extends T9> source9,
@NonNull Function9 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> combiner) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
@@ -1163,7 +1164,7 @@ public static Flowable combineLatest(
* Concatenates elements of each {@link Publisher} provided via an {@link Iterable} sequence into a single sequence
* of elements without interleaving them.
*
- *
+ *
*
*
Backpressure:
*
The operator honors backpressure from downstream. The {@code Publisher}
@@ -1183,7 +1184,7 @@ public static Flowable combineLatest(
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable concat(@NonNull Iterable<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) {
+ public static <@NonNull T> Flowable concat(@NonNull Iterable<@NonNull ? extends Publisher extends T>> sources) {
Objects.requireNonNull(sources, "sources is null");
// unlike general sources, fromIterable can only throw on a boundary because it is consumed only there
return fromIterable(sources).concatMapDelayError((Function)Functions.identity(), false, 2);
@@ -1193,7 +1194,7 @@ public static Flowable concat(@NonNull Iterable<@NonNull ? extends Publis
* Returns a {@code Flowable} that emits the items emitted by each of the {@link Publisher}s emitted by the source
* {@code Publisher}, one after the other, without interleaving them.
*
- *
+ *
*
*
Backpressure:
*
The operator honors backpressure from downstream. Both the outer and inner {@code Publisher}
@@ -1207,8 +1208,7 @@ public static Flowable concat(@NonNull Iterable<@NonNull ? extends Publis
* @param the common element base type
* @param sources
* a {@code Publisher} that emits {@code Publisher}s
- * @return a {@code Flowable} that emits items all of the items emitted by the {@code Publisher}s emitted by
- * {@code Publisher}s, one after the other, without interleaving them
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} is {@code null}
* @see ReactiveX operators documentation: Concat
*/
@@ -1216,7 +1216,7 @@ public static Flowable concat(@NonNull Iterable<@NonNull ? extends Publis
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources) {
+ public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher extends T>> sources) {
return concat(sources, bufferSize());
}
@@ -1224,7 +1224,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi
* Returns a {@code Flowable} that emits the items emitted by each of the {@link Publisher}s emitted by the source
* {@code Publisher}, one after the other, without interleaving them.
*
- *
+ *
*
*
Backpressure:
*
The operator honors backpressure from downstream. Both the outer and inner {@code Publisher}
@@ -1240,8 +1240,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi
* a {@code Publisher} that emits {@code Publisher}s
* @param prefetch
* the number of {@code Publisher}s to prefetch from the sources sequence.
- * @return a {@code Flowable} that emits items all of the items emitted by the {@code Publisher}s emitted by
- * {@code Publisher}s, one after the other, without interleaving them
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code sources} is {@code null}
* @throws IllegalArgumentException if {@code prefetch} is non-positive
* @see ReactiveX operators documentation: Concat
@@ -1251,7 +1250,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
- public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher<@NonNull ? extends T>> sources, int prefetch) {
+ public static <@NonNull T> Flowable concat(@NonNull Publisher<@NonNull ? extends Publisher extends T>> sources, int prefetch) {
return fromPublisher(sources).concatMap((Function)Functions.identity(), prefetch);
}
@@ -1259,7 +1258,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi
* Returns a {@code Flowable} that emits the items emitted by two {@link Publisher}s, one after the other, without
* interleaving them.
*
- *
+ *
*
*
Backpressure:
*
The operator honors backpressure from downstream. The {@code Publisher}
@@ -1275,8 +1274,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi
* a {@code Publisher} to be concatenated
* @param source2
* a {@code Publisher} to be concatenated
- * @return a {@code Flowable} that emits items emitted by the two source {@code Publisher}s, one after the other,
- * without interleaving them
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1} or {@code source2} is {@code null}
* @see ReactiveX operators documentation: Concat
*/
@@ -1284,7 +1282,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends Publi
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable concat(@NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2) {
+ public static <@NonNull T> Flowable concat(@NonNull Publisher extends T> source1, @NonNull Publisher extends T> source2) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
return concatArray(source1, source2);
@@ -1294,7 +1292,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends T> so
* Returns a {@code Flowable} that emits the items emitted by three {@link Publisher}s, one after the other, without
* interleaving them.
*
- *
+ *
*
*
Backpressure:
*
The operator honors backpressure from downstream. The {@code Publisher}
@@ -1312,8 +1310,7 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends T> so
* a {@code Publisher} to be concatenated
* @param source3
* a {@code Publisher} to be concatenated
- * @return a {@code Flowable} that emits items emitted by the three source {@code Publisher}s, one after the other,
- * without interleaving them
+ * @return the new {@code Flowable} instance
* @throws NullPointerException if {@code source1}, {@code source2} or {@code source3} is {@code null}
* @see ReactiveX operators documentation: Concat
*/
@@ -1321,9 +1318,9 @@ public static Flowable concat(@NonNull Publisher<@NonNull ? extends T> so
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
- public static Flowable concat(
- @NonNull Publisher<@NonNull ? extends T> source1, @NonNull Publisher<@NonNull ? extends T> source2,
- @NonNull Publisher<@NonNull ? extends T> source3) {
+ public static <@NonNull T> Flowable concat(
+ @NonNull Publisher extends T> source1, @NonNull Publisher extends T> source2,
+ @NonNull Publisher extends T> source3) {
Objects.requireNonNull(source1, "source1 is null");
Objects.requireNonNull(source2, "source2 is null");
Objects.requireNonNull(source3, "source3 is null");
@@ -1334,7 +1331,7 @@ public static Flowable concat(
* Returns a {@code Flowable} that emits the items emitted by four {@link Publisher}s, one after the other, without
* interleaving them.
*