From dd18f1f2165b5a84aad6f2151355caa4880cbc48 Mon Sep 17 00:00:00 2001 From: akarnokd Date: Fri, 27 Dec 2019 14:39:49 +0100 Subject: [PATCH] 3.x: Fix diamonds, spelling, unnecessary code --- docs/Backpressure.md | 30 ++-- docs/Combining-Observables.md | 8 +- docs/How-To-Use-RxJava.md | 4 +- docs/Writing-operators-for-2.0.md | 2 +- .../rxjava3/core/BinaryFlatMapPerf.java | 36 ++--- .../rxjava3/core/CallableAsyncPerf.java | 30 ++-- .../rxjava3/core/EachTypeFlatMapPerf.java | 4 +- .../rxjava3/core/FlatMapJustPerf.java | 4 +- .../rxjava3/core/FlattenCrossMapPerf.java | 4 +- .../rxjava3/core/FlattenJustPerf.java | 4 +- .../rxjava3/core/FlattenRangePerf.java | 4 +- .../FlowableFlatMapCompletableAsyncPerf.java | 2 +- .../core/InputWithIncrementingInteger.java | 4 +- .../reactivex/rxjava3/core/JustAsyncPerf.java | 28 ++-- .../io/reactivex/rxjava3/core/MemoryPerf.java | 110 ++++++------- .../rxjava3/core/OperatorFlatMapPerf.java | 4 +- .../rxjava3/core/PerfSubscriber.java | 2 +- .../io/reactivex/rxjava3/core/ReducePerf.java | 2 +- .../reactivex/rxjava3/core/TakeUntilPerf.java | 10 +- .../rxjava3/core/ToFlowablePerf.java | 6 +- .../io/reactivex/rxjava3/core/XMapYPerf.java | 76 ++++----- .../rxjava3/parallel/ParallelPerf.java | 8 +- .../FlowableConcatMapCompletablePerf.java | 9 +- .../FlowableConcatMapMaybeEmptyPerf.java | 9 +- .../xmapz/FlowableConcatMapMaybePerf.java | 9 +- .../xmapz/FlowableConcatMapSinglePerf.java | 9 +- .../xmapz/FlowableFlatMapCompletablePerf.java | 9 +- .../xmapz/FlowableFlatMapMaybeEmptyPerf.java | 9 +- .../xmapz/FlowableFlatMapMaybePerf.java | 9 +- .../xmapz/FlowableFlatMapSinglePerf.java | 9 +- .../FlowableSwitchMapCompletablePerf.java | 9 +- .../FlowableSwitchMapMaybeEmptyPerf.java | 9 +- .../xmapz/FlowableSwitchMapMaybePerf.java | 9 +- .../xmapz/FlowableSwitchMapSinglePerf.java | 9 +- .../ObservableConcatMapCompletablePerf.java | 9 +- .../ObservableConcatMapMaybeEmptyPerf.java | 9 +- .../xmapz/ObservableConcatMapMaybePerf.java | 9 +- .../xmapz/ObservableConcatMapSinglePerf.java | 9 +- .../ObservableFlatMapCompletablePerf.java | 9 +- .../ObservableFlatMapMaybeEmptyPerf.java | 9 +- .../xmapz/ObservableFlatMapMaybePerf.java | 9 +- .../xmapz/ObservableFlatMapSinglePerf.java | 9 +- .../ObservableSwitchMapCompletablePerf.java | 9 +- .../ObservableSwitchMapMaybeEmptyPerf.java | 9 +- .../xmapz/ObservableSwitchMapMaybePerf.java | 9 +- .../xmapz/ObservableSwitchMapSinglePerf.java | 9 +- .../reactivex/rxjava3/core/Completable.java | 14 +- .../io/reactivex/rxjava3/core/Flowable.java | 148 +++++++++--------- .../java/io/reactivex/rxjava3/core/Maybe.java | 36 ++--- .../io/reactivex/rxjava3/core/Observable.java | 131 ++++++++-------- .../io/reactivex/rxjava3/core/Single.java | 43 +++-- .../exceptions/CompositeException.java | 3 +- .../rxjava3/exceptions/package-info.java | 2 +- .../internal/disposables/EmptyDisposable.java | 2 +- .../disposables/ListCompositeDisposable.java | 10 +- .../rxjava3/internal/functions/Functions.java | 88 +++++------ .../jdk8/ObservableFlatMapStream.java | 2 +- .../internal/jdk8/ParallelCollector.java | 1 - .../observers/DeferredScalarDisposable.java | 2 +- .../internal/observers/FutureObserver.java | 5 +- .../observers/FutureSingleObserver.java | 5 +- .../completable/CompletableCache.java | 2 +- .../completable/CompletableConcat.java | 4 +- .../CompletableFromObservable.java | 2 +- .../completable/CompletableFromPublisher.java | 2 +- .../completable/CompletableFromSingle.java | 2 +- .../completable/CompletableMaterialize.java | 2 +- .../completable/CompletableToFlowable.java | 2 +- .../completable/CompletableToObservable.java | 2 +- .../completable/CompletableUsing.java | 2 +- .../flowable/BlockingFlowableIterable.java | 4 +- .../flowable/BlockingFlowableLatest.java | 4 +- .../flowable/BlockingFlowableMostRecent.java | 2 +- .../flowable/BlockingFlowableNext.java | 6 +- .../operators/flowable/FlowableAll.java | 2 +- .../operators/flowable/FlowableAllSingle.java | 4 +- .../operators/flowable/FlowableAmb.java | 4 +- .../operators/flowable/FlowableAny.java | 2 +- .../operators/flowable/FlowableAnySingle.java | 4 +- .../flowable/FlowableBlockingSubscribe.java | 6 +- .../operators/flowable/FlowableBuffer.java | 8 +- .../flowable/FlowableBufferBoundary.java | 12 +- .../flowable/FlowableBufferExactBoundary.java | 6 +- .../flowable/FlowableBufferTimed.java | 24 +-- .../operators/flowable/FlowableCache.java | 8 +- .../operators/flowable/FlowableCollect.java | 2 +- .../flowable/FlowableCollectSingle.java | 4 +- .../flowable/FlowableCombineLatest.java | 10 +- .../flowable/FlowableConcatArray.java | 6 +- .../operators/flowable/FlowableConcatMap.java | 14 +- .../flowable/FlowableConcatMapEager.java | 6 +- .../FlowableConcatMapEagerPublisher.java | 2 +- .../flowable/FlowableConcatMapScheduler.java | 14 +- .../FlowableConcatWithCompletable.java | 2 +- .../flowable/FlowableConcatWithMaybe.java | 4 +- .../flowable/FlowableConcatWithSingle.java | 4 +- .../flowable/FlowableCountSingle.java | 2 +- .../operators/flowable/FlowableCreate.java | 18 +-- .../operators/flowable/FlowableDebounce.java | 6 +- .../flowable/FlowableDebounceTimed.java | 6 +- .../operators/flowable/FlowableDelay.java | 4 +- .../FlowableDelaySubscriptionOther.java | 4 +- .../flowable/FlowableDematerialize.java | 2 +- .../operators/flowable/FlowableDetach.java | 2 +- .../operators/flowable/FlowableDistinct.java | 2 +- .../FlowableDistinctUntilChanged.java | 4 +- .../flowable/FlowableDoAfterNext.java | 4 +- .../operators/flowable/FlowableDoFinally.java | 4 +- .../operators/flowable/FlowableDoOnEach.java | 6 +- .../flowable/FlowableDoOnLifecycle.java | 2 +- .../operators/flowable/FlowableElementAt.java | 2 +- .../flowable/FlowableElementAtMaybe.java | 4 +- .../flowable/FlowableElementAtSingle.java | 4 +- .../operators/flowable/FlowableFilter.java | 6 +- .../operators/flowable/FlowableFlatMap.java | 14 +- .../flowable/FlowableFlatMapCompletable.java | 4 +- ...FlowableFlatMapCompletableCompletable.java | 4 +- .../flowable/FlowableFlatMapMaybe.java | 6 +- .../flowable/FlowableFlatMapSingle.java | 6 +- .../flowable/FlowableFlattenIterable.java | 2 +- .../operators/flowable/FlowableFromArray.java | 4 +- .../flowable/FlowableFromCallable.java | 2 +- .../flowable/FlowableFromFuture.java | 2 +- .../flowable/FlowableFromObservable.java | 2 +- .../flowable/FlowableFromSupplier.java | 2 +- .../operators/flowable/FlowableGenerate.java | 2 +- .../operators/flowable/FlowableGroupBy.java | 16 +- .../operators/flowable/FlowableGroupJoin.java | 12 +- .../operators/flowable/FlowableHide.java | 2 +- .../flowable/FlowableIgnoreElements.java | 2 +- .../FlowableIgnoreElementsCompletable.java | 4 +- .../flowable/FlowableInternalHelper.java | 38 ++--- .../operators/flowable/FlowableInterval.java | 2 +- .../flowable/FlowableIntervalRange.java | 2 +- .../operators/flowable/FlowableJoin.java | 10 +- .../operators/flowable/FlowableJust.java | 2 +- .../operators/flowable/FlowableLastMaybe.java | 2 +- .../flowable/FlowableLastSingle.java | 2 +- .../flowable/FlowableMapNotification.java | 2 +- .../flowable/FlowableMaterialize.java | 6 +- .../FlowableMergeWithCompletable.java | 4 +- .../flowable/FlowableMergeWithMaybe.java | 8 +- .../flowable/FlowableMergeWithSingle.java | 8 +- .../operators/flowable/FlowableObserveOn.java | 8 +- .../FlowableOnBackpressureBuffer.java | 8 +- .../FlowableOnBackpressureBufferStrategy.java | 4 +- .../flowable/FlowableOnBackpressureDrop.java | 2 +- .../flowable/FlowableOnBackpressureError.java | 2 +- .../FlowableOnBackpressureLatest.java | 4 +- .../flowable/FlowableOnErrorNext.java | 2 +- .../flowable/FlowableOnErrorReturn.java | 2 +- .../operators/flowable/FlowablePublish.java | 20 +-- .../flowable/FlowablePublishMulticast.java | 10 +- .../operators/flowable/FlowableReduce.java | 2 +- .../flowable/FlowableReduceMaybe.java | 4 +- .../flowable/FlowableReduceSeedSingle.java | 2 +- .../flowable/FlowableReduceWithSingle.java | 2 +- .../operators/flowable/FlowableRefCount.java | 4 +- .../operators/flowable/FlowableRepeat.java | 2 +- .../flowable/FlowableRepeatUntil.java | 2 +- .../flowable/FlowableRepeatWhen.java | 10 +- .../operators/flowable/FlowableReplay.java | 30 ++-- .../flowable/FlowableRetryBiPredicate.java | 2 +- .../flowable/FlowableRetryPredicate.java | 2 +- .../operators/flowable/FlowableRetryWhen.java | 6 +- .../flowable/FlowableSamplePublisher.java | 10 +- .../flowable/FlowableSampleTimed.java | 6 +- .../flowable/FlowableScalarXMap.java | 6 +- .../operators/flowable/FlowableScan.java | 2 +- .../operators/flowable/FlowableScanSeed.java | 4 +- .../flowable/FlowableSequenceEqual.java | 8 +- .../flowable/FlowableSequenceEqualSingle.java | 8 +- .../flowable/FlowableSerialized.java | 2 +- .../operators/flowable/FlowableSingle.java | 2 +- .../flowable/FlowableSingleMaybe.java | 4 +- .../flowable/FlowableSingleSingle.java | 4 +- .../operators/flowable/FlowableSkip.java | 2 +- .../operators/flowable/FlowableSkipLast.java | 2 +- .../flowable/FlowableSkipLastTimed.java | 4 +- .../operators/flowable/FlowableSkipUntil.java | 4 +- .../operators/flowable/FlowableSkipWhile.java | 2 +- .../flowable/FlowableSubscribeOn.java | 4 +- .../flowable/FlowableSwitchIfEmpty.java | 2 +- .../operators/flowable/FlowableSwitchMap.java | 10 +- .../operators/flowable/FlowableTake.java | 9 +- .../operators/flowable/FlowableTakeLast.java | 2 +- .../flowable/FlowableTakeLastOne.java | 2 +- .../flowable/FlowableTakeLastTimed.java | 4 +- .../flowable/FlowableTakePublisher.java | 2 +- .../operators/flowable/FlowableTakeUntil.java | 4 +- .../flowable/FlowableTakeUntilPredicate.java | 2 +- .../operators/flowable/FlowableTakeWhile.java | 2 +- .../flowable/FlowableThrottleFirstTimed.java | 4 +- .../flowable/FlowableThrottleLatest.java | 4 +- .../flowable/FlowableTimeInterval.java | 4 +- .../operators/flowable/FlowableTimeout.java | 8 +- .../flowable/FlowableTimeoutTimed.java | 8 +- .../operators/flowable/FlowableToList.java | 2 +- .../flowable/FlowableToListSingle.java | 4 +- .../flowable/FlowableUnsubscribeOn.java | 2 +- .../operators/flowable/FlowableUsing.java | 2 +- .../operators/flowable/FlowableWindow.java | 24 +-- .../flowable/FlowableWindowBoundary.java | 10 +- .../FlowableWindowBoundarySelector.java | 14 +- .../flowable/FlowableWindowTimed.java | 22 +-- .../flowable/FlowableWithLatestFrom.java | 8 +- .../flowable/FlowableWithLatestFromMany.java | 8 +- .../operators/flowable/FlowableZip.java | 6 +- .../internal/operators/maybe/MaybeCache.java | 6 +- .../operators/maybe/MaybeConcatArray.java | 4 +- .../maybe/MaybeConcatArrayDelayError.java | 4 +- .../operators/maybe/MaybeConcatIterable.java | 4 +- .../internal/operators/maybe/MaybeCreate.java | 2 +- .../internal/operators/maybe/MaybeDelay.java | 2 +- .../maybe/MaybeDelayOtherPublisher.java | 4 +- .../MaybeDelaySubscriptionOtherPublisher.java | 4 +- .../maybe/MaybeDelayWithCompletable.java | 4 +- .../internal/operators/maybe/MaybeDetach.java | 2 +- .../operators/maybe/MaybeDoAfterSuccess.java | 2 +- .../operators/maybe/MaybeDoFinally.java | 2 +- .../operators/maybe/MaybeDoOnEvent.java | 2 +- .../operators/maybe/MaybeEqualSingle.java | 6 +- .../internal/operators/maybe/MaybeFilter.java | 2 +- .../operators/maybe/MaybeFilterSingle.java | 2 +- .../maybe/MaybeFlatMapBiSelector.java | 2 +- .../maybe/MaybeFlatMapCompletable.java | 2 +- .../maybe/MaybeFlatMapIterableFlowable.java | 4 +- .../maybe/MaybeFlatMapIterableObservable.java | 4 +- .../maybe/MaybeFlatMapNotification.java | 2 +- .../operators/maybe/MaybeFlatMapSingle.java | 2 +- .../maybe/MaybeFlatMapSingleElement.java | 2 +- .../operators/maybe/MaybeFlatten.java | 2 +- .../operators/maybe/MaybeFromRunnable.java | 2 +- .../operators/maybe/MaybeFromSingle.java | 2 +- .../internal/operators/maybe/MaybeHide.java | 2 +- .../operators/maybe/MaybeIgnoreElement.java | 2 +- .../maybe/MaybeIgnoreElementCompletable.java | 4 +- .../operators/maybe/MaybeIsEmpty.java | 2 +- .../operators/maybe/MaybeIsEmptySingle.java | 4 +- .../operators/maybe/MaybeMaterialize.java | 2 +- .../operators/maybe/MaybeMergeArray.java | 8 +- .../operators/maybe/MaybeObserveOn.java | 2 +- .../operators/maybe/MaybeOnErrorComplete.java | 2 +- .../operators/maybe/MaybeOnErrorNext.java | 2 +- .../operators/maybe/MaybeOnErrorReturn.java | 2 +- .../internal/operators/maybe/MaybePeek.java | 2 +- .../operators/maybe/MaybeSubscribeOn.java | 4 +- .../operators/maybe/MaybeSwitchIfEmpty.java | 2 +- .../maybe/MaybeSwitchIfEmptySingle.java | 2 +- .../operators/maybe/MaybeTakeUntilMaybe.java | 4 +- .../maybe/MaybeTakeUntilPublisher.java | 4 +- .../operators/maybe/MaybeTimeoutMaybe.java | 6 +- .../maybe/MaybeTimeoutPublisher.java | 6 +- .../operators/maybe/MaybeToFlowable.java | 2 +- .../operators/maybe/MaybeToObservable.java | 2 +- .../operators/maybe/MaybeToPublisher.java | 4 +- .../operators/maybe/MaybeToSingle.java | 2 +- .../operators/maybe/MaybeUnsubscribeOn.java | 2 +- .../operators/maybe/MaybeZipArray.java | 6 +- .../operators/maybe/MaybeZipIterable.java | 4 +- .../mixed/CompletableAndThenObservable.java | 2 +- .../mixed/FlowableConcatMapCompletable.java | 4 +- .../mixed/FlowableConcatMapMaybe.java | 6 +- .../mixed/FlowableConcatMapSingle.java | 6 +- .../mixed/FlowableSwitchMapCompletable.java | 4 +- .../mixed/FlowableSwitchMapMaybe.java | 8 +- .../mixed/FlowableSwitchMapSingle.java | 8 +- .../mixed/MaterializeSingleObserver.java | 6 +- .../mixed/MaybeFlatMapObservable.java | 2 +- .../mixed/MaybeFlatMapPublisher.java | 2 +- .../mixed/ObservableConcatMapCompletable.java | 4 +- .../mixed/ObservableConcatMapMaybe.java | 6 +- .../mixed/ObservableConcatMapSingle.java | 6 +- .../mixed/ObservableSwitchMapCompletable.java | 4 +- .../mixed/ObservableSwitchMapMaybe.java | 8 +- .../mixed/ObservableSwitchMapSingle.java | 8 +- .../mixed/SingleFlatMapObservable.java | 2 +- .../BlockingObservableIterable.java | 4 +- .../observable/BlockingObservableLatest.java | 4 +- .../BlockingObservableMostRecent.java | 2 +- .../observable/BlockingObservableNext.java | 8 +- .../operators/observable/ObservableAll.java | 2 +- .../observable/ObservableAllSingle.java | 4 +- .../operators/observable/ObservableAmb.java | 4 +- .../operators/observable/ObservableAny.java | 2 +- .../observable/ObservableAnySingle.java | 4 +- .../ObservableBlockingSubscribe.java | 6 +- .../observable/ObservableBuffer.java | 6 +- .../observable/ObservableBufferBoundary.java | 12 +- .../ObservableBufferExactBoundary.java | 6 +- .../observable/ObservableBufferTimed.java | 24 +-- .../operators/observable/ObservableCache.java | 8 +- .../observable/ObservableCollect.java | 2 +- .../observable/ObservableCollectSingle.java | 4 +- .../observable/ObservableCombineLatest.java | 6 +- .../observable/ObservableConcatMap.java | 14 +- .../observable/ObservableConcatMapEager.java | 8 +- .../ObservableConcatMapScheduler.java | 14 +- .../ObservableConcatWithCompletable.java | 2 +- .../observable/ObservableConcatWithMaybe.java | 2 +- .../ObservableConcatWithSingle.java | 2 +- .../observable/ObservableCountSingle.java | 2 +- .../observable/ObservableCreate.java | 6 +- .../observable/ObservableDebounce.java | 6 +- .../observable/ObservableDebounceTimed.java | 6 +- .../operators/observable/ObservableDelay.java | 4 +- .../observable/ObservableDematerialize.java | 2 +- .../observable/ObservableDetach.java | 2 +- .../observable/ObservableDistinct.java | 2 +- .../ObservableDistinctUntilChanged.java | 2 +- .../observable/ObservableDoAfterNext.java | 2 +- .../observable/ObservableDoFinally.java | 2 +- .../observable/ObservableDoOnEach.java | 2 +- .../observable/ObservableDoOnLifecycle.java | 2 +- .../observable/ObservableElementAt.java | 2 +- .../observable/ObservableElementAtMaybe.java | 4 +- .../observable/ObservableElementAtSingle.java | 4 +- .../observable/ObservableFilter.java | 2 +- .../observable/ObservableFlatMap.java | 14 +- .../ObservableFlatMapCompletable.java | 4 +- ...servableFlatMapCompletableCompletable.java | 4 +- .../observable/ObservableFlatMapMaybe.java | 6 +- .../observable/ObservableFlatMapSingle.java | 6 +- .../observable/ObservableFlattenIterable.java | 2 +- .../observable/ObservableFromArray.java | 2 +- .../observable/ObservableFromCallable.java | 2 +- .../observable/ObservableFromFuture.java | 2 +- .../observable/ObservableFromIterable.java | 2 +- .../observable/ObservableFromSupplier.java | 2 +- .../observable/ObservableGenerate.java | 2 +- .../observable/ObservableGroupBy.java | 16 +- .../observable/ObservableGroupJoin.java | 10 +- .../operators/observable/ObservableHide.java | 2 +- .../observable/ObservableIgnoreElements.java | 2 +- .../ObservableIgnoreElementsCompletable.java | 4 +- .../observable/ObservableInternalHelper.java | 38 ++--- .../operators/observable/ObservableJoin.java | 10 +- .../operators/observable/ObservableJust.java | 2 +- .../observable/ObservableLastMaybe.java | 2 +- .../observable/ObservableLastSingle.java | 2 +- .../observable/ObservableMapNotification.java | 2 +- .../observable/ObservableMaterialize.java | 2 +- .../ObservableMergeWithCompletable.java | 4 +- .../observable/ObservableMergeWithMaybe.java | 8 +- .../observable/ObservableMergeWithSingle.java | 8 +- .../observable/ObservableObserveOn.java | 4 +- .../observable/ObservableOnErrorNext.java | 2 +- .../observable/ObservableOnErrorReturn.java | 2 +- .../observable/ObservablePublish.java | 10 +- .../observable/ObservablePublishSelector.java | 8 +- .../operators/observable/ObservableRange.java | 2 +- .../observable/ObservableRangeLong.java | 2 +- .../observable/ObservableReduceMaybe.java | 2 +- .../ObservableReduceSeedSingle.java | 2 +- .../ObservableReduceWithSingle.java | 2 +- .../observable/ObservableRefCount.java | 4 +- .../observable/ObservableRepeat.java | 2 +- .../observable/ObservableRepeatUntil.java | 2 +- .../observable/ObservableRepeatWhen.java | 4 +- .../observable/ObservableReplay.java | 32 ++-- .../ObservableRetryBiPredicate.java | 2 +- .../observable/ObservableRetryPredicate.java | 2 +- .../observable/ObservableRetryWhen.java | 4 +- .../observable/ObservableSampleTimed.java | 8 +- .../ObservableSampleWithObservable.java | 10 +- .../observable/ObservableScalarXMap.java | 8 +- .../operators/observable/ObservableScan.java | 2 +- .../observable/ObservableScanSeed.java | 2 +- .../observable/ObservableSequenceEqual.java | 8 +- .../ObservableSequenceEqualSingle.java | 10 +- .../observable/ObservableSerialized.java | 2 +- .../observable/ObservableSingleMaybe.java | 2 +- .../observable/ObservableSingleSingle.java | 2 +- .../operators/observable/ObservableSkip.java | 2 +- .../observable/ObservableSkipLast.java | 2 +- .../observable/ObservableSkipLastTimed.java | 4 +- .../observable/ObservableSkipUntil.java | 4 +- .../observable/ObservableSkipWhile.java | 2 +- .../observable/ObservableSubscribeOn.java | 4 +- .../observable/ObservableSwitchIfEmpty.java | 2 +- .../observable/ObservableSwitchMap.java | 10 +- .../operators/observable/ObservableTake.java | 2 +- .../observable/ObservableTakeLast.java | 2 +- .../observable/ObservableTakeLastOne.java | 2 +- .../observable/ObservableTakeLastTimed.java | 4 +- .../observable/ObservableTakeUntil.java | 4 +- .../ObservableTakeUntilPredicate.java | 2 +- .../observable/ObservableTakeWhile.java | 2 +- .../ObservableThrottleFirstTimed.java | 4 +- .../observable/ObservableThrottleLatest.java | 4 +- .../observable/ObservableTimeInterval.java | 4 +- .../observable/ObservableTimeout.java | 8 +- .../observable/ObservableTimeoutTimed.java | 8 +- .../observable/ObservableToList.java | 2 +- .../observable/ObservableToListSingle.java | 4 +- .../observable/ObservableUnsubscribeOn.java | 2 +- .../operators/observable/ObservableUsing.java | 2 +- .../observable/ObservableWindow.java | 10 +- .../observable/ObservableWindowBoundary.java | 10 +- .../ObservableWindowBoundarySelector.java | 14 +- .../observable/ObservableWindowTimed.java | 22 +-- .../observable/ObservableWithLatestFrom.java | 8 +- .../ObservableWithLatestFromMany.java | 8 +- .../operators/observable/ObservableZip.java | 8 +- .../observable/ObserverResourceWrapper.java | 2 +- .../operators/single/SingleCache.java | 4 +- .../operators/single/SingleCreate.java | 2 +- .../single/SingleDelayWithCompletable.java | 4 +- .../single/SingleDelayWithObservable.java | 4 +- .../single/SingleDelayWithPublisher.java | 4 +- .../single/SingleDelayWithSingle.java | 4 +- .../operators/single/SingleDematerialize.java | 2 +- .../operators/single/SingleDetach.java | 2 +- .../single/SingleDoAfterSuccess.java | 2 +- .../single/SingleDoAfterTerminate.java | 2 +- .../operators/single/SingleDoFinally.java | 2 +- .../operators/single/SingleDoOnDispose.java | 2 +- .../operators/single/SingleDoOnSubscribe.java | 2 +- .../single/SingleFlatMapCompletable.java | 2 +- .../single/SingleFlatMapIterableFlowable.java | 4 +- .../SingleFlatMapIterableObservable.java | 4 +- .../single/SingleFlatMapPublisher.java | 4 +- .../single/SingleInternalHelper.java | 12 +- .../operators/single/SingleMaterialize.java | 2 +- .../operators/single/SingleObserveOn.java | 2 +- .../operators/single/SingleResumeNext.java | 2 +- .../operators/single/SingleSubscribeOn.java | 2 +- .../operators/single/SingleTakeUntil.java | 2 +- .../operators/single/SingleTimeout.java | 6 +- .../operators/single/SingleToObservable.java | 2 +- .../operators/single/SingleUnsubscribeOn.java | 2 +- .../operators/single/SingleZipArray.java | 6 +- .../operators/single/SingleZipIterable.java | 4 +- .../internal/queue/MpscLinkedQueue.java | 8 +- .../internal/queue/SpscLinkedArrayQueue.java | 8 +- .../schedulers/AbstractDirectTask.java | 4 +- .../schedulers/ComputationScheduler.java | 2 +- .../internal/schedulers/DisposeOnCancel.java | 6 +- .../schedulers/ExecutorScheduler.java | 2 +- .../schedulers/InstantPeriodicTask.java | 8 +- .../internal/schedulers/IoScheduler.java | 4 +- .../internal/schedulers/RxThreadFactory.java | 4 +- .../schedulers/ScheduledDirectTask.java | 2 +- .../schedulers/SchedulerPoolFactory.java | 8 +- .../internal/schedulers/SingleScheduler.java | 2 +- .../schedulers/TrampolineScheduler.java | 2 +- .../subscribers/FutureSubscriber.java | 5 +- .../subscribers/StrictSubscriber.java | 2 +- .../SubscriberResourceWrapper.java | 2 +- .../subscriptions/AsyncSubscription.java | 4 +- .../subscriptions/SubscriptionArbiter.java | 2 +- .../internal/util/ArrayListSupplier.java | 4 +- .../internal/util/ConnectConsumer.java | 2 +- .../internal/util/ExceptionHelper.java | 8 +- .../internal/util/HashMapSupplier.java | 2 +- .../internal/util/LinkedArrayList.java | 2 +- .../internal/util/ListAddBiConsumer.java | 2 +- .../internal/util/MergerBiFunction.java | 6 +- .../internal/util/QueueDrainHelper.java | 4 +- .../rxjava3/internal/util/SorterFunction.java | 2 +- .../internal/util/VolatileSizeArrayList.java | 18 ++- .../rxjava3/parallel/ParallelFlowable.java | 21 ++- .../processors/MulticastProcessor.java | 2 +- .../rxjava3/processors/ReplayProcessor.java | 14 +- .../rxjava3/schedulers/Schedulers.java | 20 +-- .../rxjava3/subjects/ReplaySubject.java | 12 +- .../rxjava3/subjects/UnicastSubject.java | 8 +- 467 files changed, 1513 insertions(+), 1600 deletions(-) diff --git a/docs/Backpressure.md b/docs/Backpressure.md index 8feec0d487..bfe90330bb 100644 --- a/docs/Backpressure.md +++ b/docs/Backpressure.md @@ -34,25 +34,25 @@ The following diagrams show how you could use each of these operators on the bur The `sample` operator periodically "dips" into the sequence and emits only the most recently emitted item during each dip: ​ -````groovy +```java 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": ​ -````groovy +```java Observable burstyThrottled = bursty.throttleFirst(500, TimeUnit.MILLISECONDS); -```` +``` ### 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: ​ -````groovy +```java Observable burstyDebounced = bursty.debounce(10, TimeUnit.MILLISECONDS); -```` +``` ## Buffers and windows @@ -65,14 +65,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: ​ -````groovy +```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: ​ -````groovy +```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: Observable burstyMulticast = bursty.publish().refCount(); @@ -87,16 +87,16 @@ 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: ​ -````groovy +```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: ​ -````groovy +```java Observable> burstyWindowed = bursty.window(5); -```` +``` # Callstack blocking as a flow-control alternative to backpressure @@ -110,8 +110,8 @@ When you subscribe to an `Observable` with a `Subscriber`, you can request react Then, after handling this item (or these items) in `onNext()`, you can call `request()` again to instruct the `Observable` to emit another item (or items). Here is an example of a `Subscriber` that requests one item at a time from `someObservable`: -````java -someObservable.subscribe(new Subscriber() { +```java +someObservable.subscribe(new Subscriber() { @Override public void onStart() { request(1); @@ -134,7 +134,7 @@ someObservable.subscribe(new Subscriber() { request(1); } }); -```` +``` You can pass a magic number to `request`, `request(Long.MAX_VALUE)`, to disable reactive pull backpressure and to ask the Observable to emit items at its own pace. `request(0)` is a legal call, but has no effect. Passing values less than zero to `request` will cause an exception to be thrown. diff --git a/docs/Combining-Observables.md b/docs/Combining-Observables.md index bcc19f6b0f..fcde91b76b 100644 --- a/docs/Combining-Observables.md +++ b/docs/Combining-Observables.md @@ -2,13 +2,13 @@ This section explains operators you can use to combine multiple Observables. # Outline -- [`combineLatest`](#combineLatest) +- [`combineLatest`](#combinelatest) - [`join` and `groupJoin`](#joins) - [`merge`](#merge) -- [`mergeDelayError`](#mergeDelayError) +- [`mergeDelayError`](#mergedelayerror) - [`rxjava-joins`](#rxjava-joins) -- [`startWith`](#startWith) -- [`switchOnNext`](#switchOnNext) +- [`startWith`](#startwith) +- [`switchOnNext`](#switchonnext) - [`zip`](#zip) ## startWith diff --git a/docs/How-To-Use-RxJava.md b/docs/How-To-Use-RxJava.md index 16d156caa9..ad309496b9 100644 --- a/docs/How-To-Use-RxJava.md +++ b/docs/How-To-Use-RxJava.md @@ -96,9 +96,9 @@ You use the Observable [`just( )`](http://reactivex.io/documentation/operators Observable o = Observable.from("a", "b", "c"); def list = [5, 6, 7, 8] -Observable o = Observable.from(list); +Observable o2 = Observable.from(list); -Observable o = Observable.just("one object"); +Observable o3 = Observable.just("one object"); ``` These converted Observables will synchronously invoke the [`onNext( )`](Observable#onnext-oncompleted-and-onerror) method of any subscriber that subscribes to them, for each item to be emitted by the Observable, and will then invoke the subscriber’s [`onCompleted( )`](Observable#onnext-oncompleted-and-onerror) method. diff --git a/docs/Writing-operators-for-2.0.md b/docs/Writing-operators-for-2.0.md index 7b6e57666e..e8486564b1 100644 --- a/docs/Writing-operators-for-2.0.md +++ b/docs/Writing-operators-for-2.0.md @@ -1,7 +1,7 @@ ##### Table of contents - [Introduction](#introduction) - - [Warning on internal components](warning-on-internal-components) + - [Warning on internal components](#warning-on-internal-components) - [Atomics, serialization, deferred actions](#atomics-serialization-deferred-actions) - [Field updaters and Android](#field-updaters-and-android) - [Request accounting](#request-accounting) diff --git a/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java index 6d5bb44b23..836957192e 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java @@ -86,48 +86,42 @@ public void setup() { singleFlatMapPublisher = Single.just(1).flatMapPublisher(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return arrayFlowable; } }); singleFlatMapHidePublisher = Single.just(1).flatMapPublisher(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return arrayFlowableHide; } }); singleFlattenAsPublisher = Single.just(1).flattenAsFlowable(new Function>() { @Override - public Iterable apply(Integer v) - throws Exception { + public Iterable apply(Integer v) { return list; } }); maybeFlatMapPublisher = Maybe.just(1).flatMapPublisher(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return arrayFlowable; } }); maybeFlatMapHidePublisher = Maybe.just(1).flatMapPublisher(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return arrayFlowableHide; } }); maybeFlattenAsPublisher = Maybe.just(1).flattenAsFlowable(new Function>() { @Override - public Iterable apply(Integer v) - throws Exception { + public Iterable apply(Integer v) { return list; } }); @@ -140,48 +134,42 @@ public Iterable apply(Integer v) singleFlatMapObservable = Single.just(1).flatMapObservable(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return arrayObservable; } }); singleFlatMapHideObservable = Single.just(1).flatMapObservable(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return arrayObservableHide; } }); singleFlattenAsObservable = Single.just(1).flattenAsObservable(new Function>() { @Override - public Iterable apply(Integer v) - throws Exception { + public Iterable apply(Integer v) { return list; } }); maybeFlatMapObservable = Maybe.just(1).flatMapObservable(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return arrayObservable; } }); maybeFlatMapHideObservable = Maybe.just(1).flatMapObservable(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return arrayObservableHide; } }); maybeFlattenAsObservable = Maybe.just(1).flattenAsObservable(new Function>() { @Override - public Iterable apply(Integer v) - throws Exception { + public Iterable apply(Integer v) { return list; } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java index 4afa54ecc8..8098b1aaf4 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/CallableAsyncPerf.java @@ -68,7 +68,7 @@ public void setup() { Callable c = new Callable() { @Override - public Integer call() throws Exception { + public Integer call() { return 1; } }; @@ -120,71 +120,71 @@ public void subscribeOnFlowable(Blackhole bh) { @Benchmark public void observeOnFlowable(Blackhole bh) { observeOnFlowable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineFlowable(Blackhole bh) { pipelineFlowable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnObservable(Blackhole bh) { subscribeOnObservable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnObservable(Blackhole bh) { observeOnObservable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineObservable(Blackhole bh) { pipelineObservable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnSingle(Blackhole bh) { observeOnSingle.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnSingle(Blackhole bh) { subscribeOnSingle.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineSingle(Blackhole bh) { pipelineSingle.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnCompletable(Blackhole bh) { observeOnCompletable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnCompletable(Blackhole bh) { subscribeOnCompletable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineCompletable(Blackhole bh) { pipelineCompletable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnMaybe(Blackhole bh) { observeOnMaybe.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnMaybe(Blackhole bh) { subscribeOnMaybe.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineMaybe(Blackhole bh) { pipelineMaybe.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } } diff --git a/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java index e05921c531..37a4f196e8 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/EachTypeFlatMapPerf.java @@ -114,11 +114,11 @@ public void nbpRangeMapRange(Blackhole bh) { @Benchmark public void singleJust(Blackhole bh) { - singleJust.subscribe(new LatchedSingleObserver(bh)); + singleJust.subscribe(new LatchedSingleObserver<>(bh)); } @Benchmark public void singleJustMapJust(Blackhole bh) { - singleJustMapJust.subscribe(new LatchedSingleObserver(bh)); + singleJustMapJust.subscribe(new LatchedSingleObserver<>(bh)); } } diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java index 8541f92834..2a1fd7539c 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlatMapJustPerf.java @@ -41,14 +41,14 @@ public void setup() { flowable = Flowable.fromArray(array).flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); observable = Observable.fromArray(array).flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java index cfc5a1af97..866fe5de77 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlattenCrossMapPerf.java @@ -47,14 +47,14 @@ public void setup() { flowable = Flowable.fromArray(array).flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return list; } }); observable = Observable.fromArray(array).flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return list; } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java index bb2394a053..d2ac9aa5b7 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlattenJustPerf.java @@ -44,14 +44,14 @@ public void setup() { flowable = Flowable.fromArray(array).flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return singletonList; } }); observable = Observable.fromArray(array).flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return singletonList; } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java index 663fd8cdde..a3195b760d 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlattenRangePerf.java @@ -44,14 +44,14 @@ public void setup() { flowable = Flowable.fromArray(array).flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return list; } }); observable = Observable.fromArray(array).flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return list; } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java index 83f2d4c4f4..e9494e97df 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/FlowableFlatMapCompletableAsyncPerf.java @@ -45,7 +45,7 @@ public class FlowableFlatMapCompletableAsyncPerf implements Action { Flowable flatMap; @Override - public void run() throws Exception { + public void run() { Blackhole.consumeCPU(work); } diff --git a/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java b/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java index 24c4e016d3..772d202dca 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/InputWithIncrementingInteger.java @@ -43,7 +43,7 @@ public void onNext(Integer t) { } } - final class IncrementingIterable implements Iterable { + static final class IncrementingIterable implements Iterable { final class IncrementingIterator implements Iterator { int i; @@ -77,7 +77,7 @@ public Iterator iterator() { } } - final class IncrementingPublisher implements Publisher { + static final class IncrementingPublisher implements Publisher { final int size; diff --git a/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java index d22c1699e5..f60204c88b 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/JustAsyncPerf.java @@ -113,71 +113,71 @@ public void subscribeOnFlowable(Blackhole bh) { @Benchmark public void observeOnFlowable(Blackhole bh) { observeOnFlowable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineFlowable(Blackhole bh) { pipelineFlowable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnObservable(Blackhole bh) { subscribeOnObservable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnObservable(Blackhole bh) { observeOnObservable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineObservable(Blackhole bh) { pipelineObservable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnSingle(Blackhole bh) { observeOnSingle.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnSingle(Blackhole bh) { subscribeOnSingle.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineSingle(Blackhole bh) { pipelineSingle.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnCompletable(Blackhole bh) { observeOnCompletable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnCompletable(Blackhole bh) { subscribeOnCompletable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineCompletable(Blackhole bh) { pipelineCompletable.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void observeOnMaybe(Blackhole bh) { observeOnMaybe.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void subscribeOnMaybe(Blackhole bh) { subscribeOnMaybe.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } @Benchmark public void pipelineMaybe(Blackhole bh) { pipelineMaybe.subscribeWith(new PerfAsyncConsumer(bh)).await(1); - }; + } } diff --git a/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java index b7ed7e4ae1..c7c407de15 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/MemoryPerf.java @@ -143,31 +143,31 @@ public static void main(String[] args) throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.just(1); } }, "just", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.range(1, 10); } }, "range", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.empty(); } }, "empty", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.fromCallable(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return 1; } }); @@ -176,38 +176,38 @@ public Object call() throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return new MyRx2Observer(); } }, "consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return new io.reactivex.rxjava3.observers.TestObserver<>(); } }, "test-consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.just(1).subscribeWith(new MyRx2Observer()); } }, "just+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.range(1, 10).subscribeWith(new MyRx2Observer()); } }, "range+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.range(1, 10).map(new Function() { @Override - public Object apply(Integer v) throws Exception { + public Object apply(Integer v) { return v; } }).subscribeWith(new MyRx2Observer()); @@ -216,15 +216,15 @@ public Object apply(Integer v) throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.range(1, 10).map(new Function() { @Override - public Object apply(Integer v) throws Exception { + public Object apply(Integer v) { return v; } }).filter(new Predicate() { @Override - public boolean test(Object v) throws Exception { + public boolean test(Object v) { return true; } }).subscribeWith(new MyRx2Observer()); @@ -233,91 +233,91 @@ public boolean test(Object v) throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.range(1, 10).subscribeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Observer()); } }, "range+subscribeOn+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.range(1, 10).observeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Observer()); } }, "range+observeOn+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Observable.range(1, 10).subscribeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).observeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Observer()); } }, "range+subscribeOn+observeOn+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.AsyncSubject.create(); } }, "Async", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.PublishSubject.create(); } }, "Publish", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.ReplaySubject.create(); } }, "Replay", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.BehaviorSubject.create(); } }, "Behavior", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.UnicastSubject.create(); } }, "Unicast", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.AsyncSubject.create().subscribeWith(new MyRx2Observer()); } }, "Async+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.PublishSubject.create().subscribeWith(new MyRx2Observer()); } }, "Publish+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.ReplaySubject.create().subscribeWith(new MyRx2Observer()); } }, "Replay+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.BehaviorSubject.create().subscribeWith(new MyRx2Observer()); } }, "Behavior+consumer", "Rx2Observable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.subjects.UnicastSubject.create().subscribeWith(new MyRx2Observer()); } }, "Unicast+consumer", "Rx2Observable"); @@ -326,38 +326,38 @@ public Object call() throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.just(1); } }, "just", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.range(1, 10); } }, "range", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.empty(); } }, "empty", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.empty(); } }, "empty", "Rx2Flowable", 10000000); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.fromCallable(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return 1; } }); @@ -366,38 +366,38 @@ public Object call() throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return new MyRx2Subscriber(); } }, "consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return new io.reactivex.rxjava3.observers.TestObserver<>(); } }, "test-consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.just(1).subscribeWith(new MyRx2Subscriber()); } }, "just+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.range(1, 10).subscribeWith(new MyRx2Subscriber()); } }, "range+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.range(1, 10).map(new Function() { @Override - public Object apply(Integer v) throws Exception { + public Object apply(Integer v) { return v; } }).subscribeWith(new MyRx2Subscriber()); @@ -406,15 +406,15 @@ public Object apply(Integer v) throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.range(1, 10).map(new Function() { @Override - public Object apply(Integer v) throws Exception { + public Object apply(Integer v) { return v; } }).filter(new Predicate() { @Override - public boolean test(Object v) throws Exception { + public boolean test(Object v) { return true; } }).subscribeWith(new MyRx2Subscriber()); @@ -423,91 +423,91 @@ public boolean test(Object v) throws Exception { checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.range(1, 10).subscribeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Subscriber()); } }, "range+subscribeOn+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.range(1, 10).observeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Subscriber()); } }, "range+observeOn+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.core.Flowable.range(1, 10).subscribeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).observeOn(io.reactivex.rxjava3.schedulers.Schedulers.computation()).subscribeWith(new MyRx2Subscriber()); } }, "range+subscribeOn+observeOn+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.AsyncProcessor.create(); } }, "Async", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.PublishProcessor.create(); } }, "Publish", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.ReplayProcessor.create(); } }, "Replay", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.BehaviorProcessor.create(); } }, "Behavior", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.UnicastProcessor.create(); } }, "Unicast", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.AsyncProcessor.create().subscribeWith(new MyRx2Subscriber()); } }, "Async+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.PublishProcessor.create().subscribeWith(new MyRx2Subscriber()); } }, "Publish+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.ReplayProcessor.create().subscribeWith(new MyRx2Subscriber()); } }, "Replay+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.BehaviorProcessor.create().subscribeWith(new MyRx2Subscriber()); } }, "Behavior+consumer", "Rx2Flowable"); checkMemory(new Callable() { @Override - public Object call() throws Exception { + public Object call() { return io.reactivex.rxjava3.processors.UnicastProcessor.create().subscribeWith(new MyRx2Subscriber()); } }, "Unicast+consumer", "Rx2Flowable"); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java index 621894bd74..0eb7f03aa9 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/OperatorFlatMapPerf.java @@ -40,7 +40,7 @@ public int getSize() { } @Benchmark - public void flatMapIntPassthruSync(Input input) throws InterruptedException { + public void flatMapIntPassthruSync(Input input) { input.flowable.flatMap(new Function>() { @Override public Publisher apply(Integer v) { @@ -66,7 +66,7 @@ public Publisher apply(Integer i) { } @Benchmark - public void flatMapTwoNestedSync(final Input input) throws InterruptedException { + public void flatMapTwoNestedSync(final Input input) { Flowable.range(1, 2).flatMap(new Function>() { @Override public Publisher apply(Integer i) { diff --git a/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java b/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java index e4c52b5040..51da5a5c53 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/PerfSubscriber.java @@ -20,7 +20,7 @@ public class PerfSubscriber implements FlowableSubscriber { - public CountDownLatch latch = new CountDownLatch(1); + public final CountDownLatch latch = new CountDownLatch(1); private final Blackhole bh; public PerfSubscriber(Blackhole bh) { diff --git a/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java index 0282aa31e5..faf0423760 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/ReducePerf.java @@ -40,7 +40,7 @@ public class ReducePerf implements BiFunction { Maybe flowMaybe; @Override - public Integer apply(Integer t1, Integer t2) throws Exception { + public Integer apply(Integer t1, Integer t2) { return t1 + t2; } diff --git a/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java index 71161b32d3..b2f89a39ca 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/TakeUntilPerf.java @@ -39,7 +39,7 @@ public class TakeUntilPerf implements Consumer { Observable observable; @Override - public void accept(Integer t) throws Exception { + public void accept(Integer t) { items++; } @@ -48,7 +48,7 @@ public void setup() { flowable = Flowable.range(1, 1000 * 1000).takeUntil(Flowable.fromCallable(new Callable() { @Override - public Object call() throws Exception { + public Object call() { int c = count; while (items < c) { } return 1; @@ -57,7 +57,7 @@ public Object call() throws Exception { observable = Observable.range(1, 1000 * 1000).takeUntil(Observable.fromCallable(new Callable() { @Override - public Object call() throws Exception { + public Object call() { int c = count; while (items < c) { } return 1; @@ -71,7 +71,7 @@ public void flowable() { flowable.subscribe(this, Functions.emptyConsumer(), new Action() { @Override - public void run() throws Exception { + public void run() { cdl.countDown(); } }); @@ -85,7 +85,7 @@ public void observable() { observable.subscribe(this, Functions.emptyConsumer(), new Action() { @Override - public void run() throws Exception { + public void run() { cdl.countDown(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java b/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java index 28b1d050fc..9c86e83678 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/ToFlowablePerf.java @@ -48,7 +48,7 @@ public void setup() { final BiFunction second = new BiFunction() { @Override - public Integer apply(Integer a, Integer b) throws Exception { + public Integer apply(Integer a, Integer b) { return b; } }; @@ -57,7 +57,7 @@ public Integer apply(Integer a, Integer b) throws Exception { flowableInner = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Flowable.range(1, 50).reduce(second).toFlowable(); } }); @@ -68,7 +68,7 @@ public Publisher apply(Integer v) throws Exception { observableInner = sourceObs.concatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Observable.range(1, 50).reduce(second).toObservable(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java b/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java index 582d9da8dc..6205efa25d 100644 --- a/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java @@ -103,84 +103,84 @@ public void setup() { flowFlatMapFlowable1 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); flowFlatMapFlowable0 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Flowable.empty(); } }); flowFlatMapSingle1 = fsource.flatMapSingle(new Function>() { @Override - public SingleSource apply(Integer v) throws Exception { + public SingleSource apply(Integer v) { return Single.just(v); } }); flowFlatMapMaybe1 = fsource.flatMapMaybe(new Function>() { @Override - public MaybeSource apply(Integer v) throws Exception { + public MaybeSource apply(Integer v) { return Maybe.just(v); } }); flowFlatMapMaybe0 = fsource.flatMapMaybe(new Function>() { @Override - public MaybeSource apply(Integer v) throws Exception { + public MaybeSource apply(Integer v) { return Maybe.empty(); } }); flowFlatMapCompletable0 = fsource.flatMapCompletable(new Function() { @Override - public CompletableSource apply(Integer v) throws Exception { + public CompletableSource apply(Integer v) { return Completable.complete(); } }); flowFlatMapIterable1 = fsource.flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return Collections.singletonList(v); } }); flowFlatMapIterable0 = fsource.flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { - return Collections.emptyList(); + public Iterable apply(Integer v) { + return Collections.emptyList(); } }); flowFlatMapSingle1 = fsource.flatMapSingle(new Function>() { @Override - public SingleSource apply(Integer v) throws Exception { + public SingleSource apply(Integer v) { return Single.just(v); } }); flowFlatMapMaybe1 = fsource.flatMapMaybe(new Function>() { @Override - public MaybeSource apply(Integer v) throws Exception { + public MaybeSource apply(Integer v) { return Maybe.just(v); } }); flowFlatMapMaybe0 = fsource.flatMapMaybe(new Function>() { @Override - public MaybeSource apply(Integer v) throws Exception { + public MaybeSource apply(Integer v) { return Maybe.empty(); } }); flowFlatMapCompletable0 = fsource.flatMapCompletable(new Function() { @Override - public CompletableSource apply(Integer v) throws Exception { + public CompletableSource apply(Integer v) { return Completable.complete(); } }); @@ -189,43 +189,43 @@ public CompletableSource apply(Integer v) throws Exception { flowFlatMapSingleAsFlow1 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Single.just(v).toFlowable(); } }); flowFlatMapMaybeAsFlow1 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Maybe.just(v).toFlowable(); } }); flowFlatMapMaybeAsFlow0 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Maybe.empty().toFlowable(); } }); flowFlatMapCompletableAsFlow0 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { - return Completable.complete().toFlowable(); + public Publisher apply(Integer v) { + return Completable.complete().toFlowable(); } }); flowFlatMapIterableAsFlow1 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Flowable.fromIterable(Collections.singletonList(v)); } }); flowFlatMapIterableAsFlow0 = fsource.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { - return Flowable.fromIterable(Collections.emptyList()); + public Publisher apply(Integer v) { + return Flowable.fromIterable(Collections.emptyList()); } }); @@ -235,57 +235,57 @@ public Publisher apply(Integer v) throws Exception { obsFlatMapObservable1 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); obsFlatMapObservable0 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Observable.empty(); } }); obsFlatMapSingle1 = osource.flatMapSingle(new Function>() { @Override - public SingleSource apply(Integer v) throws Exception { + public SingleSource apply(Integer v) { return Single.just(v); } }); obsFlatMapMaybe1 = osource.flatMapMaybe(new Function>() { @Override - public MaybeSource apply(Integer v) throws Exception { + public MaybeSource apply(Integer v) { return Maybe.just(v); } }); obsFlatMapMaybe0 = osource.flatMapMaybe(new Function>() { @Override - public MaybeSource apply(Integer v) throws Exception { + public MaybeSource apply(Integer v) { return Maybe.empty(); } }); obsFlatMapCompletable0 = osource.flatMapCompletable(new Function() { @Override - public CompletableSource apply(Integer v) throws Exception { + public CompletableSource apply(Integer v) { return Completable.complete(); } }); obsFlatMapIterable1 = osource.flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { + public Iterable apply(Integer v) { return Collections.singletonList(v); } }); obsFlatMapIterable0 = osource.flatMapIterable(new Function>() { @Override - public Iterable apply(Integer v) throws Exception { - return Collections.emptyList(); + public Iterable apply(Integer v) { + return Collections.emptyList(); } }); @@ -293,43 +293,43 @@ public Iterable apply(Integer v) throws Exception { obsFlatMapSingleAsObs1 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Single.just(v).toObservable(); } }); obsFlatMapMaybeAsObs1 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Maybe.just(v).toObservable(); } }); obsFlatMapMaybeAsObs0 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Maybe.empty().toObservable(); } }); obsFlatMapCompletableAsObs0 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { - return Completable.complete().toObservable(); + public Observable apply(Integer v) { + return Completable.complete().toObservable(); } }); obsFlatMapIterableAsObs1 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { + public Observable apply(Integer v) { return Observable.fromIterable(Collections.singletonList(v)); } }); obsFlatMapIterableAsObs0 = osource.flatMap(new Function>() { @Override - public Observable apply(Integer v) throws Exception { - return Observable.fromIterable(Collections.emptyList()); + public Observable apply(Integer v) { + return Observable.fromIterable(Collections.emptyList()); } }); } diff --git a/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java b/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java index 31d0ecc8c5..4eaac7b0da 100644 --- a/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/parallel/ParallelPerf.java @@ -49,7 +49,7 @@ public class ParallelPerf implements Function { Flowable parallel; @Override - public Integer apply(Integer t) throws Exception { + public Integer apply(Integer t) { Blackhole.consumeCPU(compute); return t; } @@ -66,7 +66,7 @@ public void setup() { flatMap = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v).subscribeOn(Schedulers.computation()) .map(ParallelPerf.this); } @@ -75,13 +75,13 @@ public Publisher apply(Integer v) throws Exception { groupBy = source.groupBy(new Function() { int i; @Override - public Integer apply(Integer v) throws Exception { + public Integer apply(Integer v) { return (i++) % cpu; } }) .flatMap(new Function, Publisher>() { @Override - public Publisher apply(GroupedFlowable g) throws Exception { + public Publisher apply(GroupedFlowable g) { return g.observeOn(Schedulers.computation()).map(ParallelPerf.this); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java index cb58173206..9e1096ab74 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapCompletablePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.empty(); } }); flowableConvert = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Completable.complete().toFlowable(); } }); flowableDedicated = source.concatMapCompletable(new Function() { @Override - public Completable apply(Integer v) - throws Exception { + public Completable apply(Integer v) { return Completable.complete(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java index 1aff189e56..a211fbe829 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybeEmptyPerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.empty(); } }); concatMapToFlowableEmpty = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Maybe.empty().toFlowable(); } }); flowableDedicated = source.concatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.empty(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java index 38ca515171..059a0b162b 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapMaybePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); flowableConvert = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Maybe.just(v).toFlowable(); } }); flowableDedicated = source.concatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java index 04148d7a47..e812708a15 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableConcatMapSinglePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); flowableConvert = source.concatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Single.just(v).toFlowable(); } }); flowableDedicated = source.concatMapSingle(new Function>() { @Override - public Single apply(Integer v) - throws Exception { + public Single apply(Integer v) { return Single.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java index e605629a8d..1960735cfa 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapCompletablePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.empty(); } }); flowableConvert = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Completable.complete().toFlowable(); } }); flowableDedicated = source.flatMapCompletable(new Function() { @Override - public Completable apply(Integer v) - throws Exception { + public Completable apply(Integer v) { return Completable.complete(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java index 23bd80fe6b..96e6fcf672 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybeEmptyPerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.empty(); } }); flowableConvert = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Maybe.empty().toFlowable(); } }); flowableDedicated = source.flatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.empty(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java index bbbc96fc03..2f71d5793e 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapMaybePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); flowableConvert = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Maybe.just(v).toFlowable(); } }); flowableDedicated = source.flatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java index 8407a60e6a..2bbdf9bf95 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableFlatMapSinglePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); flowableConvert = source.flatMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Single.just(v).toFlowable(); } }); flowableDedicated = source.flatMapSingle(new Function>() { @Override - public Single apply(Integer v) - throws Exception { + public Single apply(Integer v) { return Single.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java index 25b4e34529..033d35c429 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapCompletablePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.empty(); } }); flowableConvert = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Completable.complete().toFlowable(); } }); flowableDedicated = source.switchMapCompletable(new Function() { @Override - public Completable apply(Integer v) - throws Exception { + public Completable apply(Integer v) { return Completable.complete(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java index ff6d5999ba..adc6060189 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybeEmptyPerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.empty(); } }); flowableConvert = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Maybe.empty().toFlowable(); } }); flowableDedicated = source.switchMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.empty(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java index 87071d1108..d5d8cb9443 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapMaybePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); flowableConvert = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Maybe.just(v).toFlowable(); } }); flowableDedicated = source.switchMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java index a633856881..a997f27b53 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/FlowableSwitchMapSinglePerf.java @@ -48,24 +48,21 @@ public void setup() { flowablePlain = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Flowable.just(v); } }); flowableConvert = source.switchMap(new Function>() { @Override - public Publisher apply(Integer v) - throws Exception { + public Publisher apply(Integer v) { return Single.just(v).toFlowable(); } }); flowableDedicated = source.switchMapSingle(new Function>() { @Override - public Single apply(Integer v) - throws Exception { + public Single apply(Integer v) { return Single.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java index 5b2b9247fc..ca6174a006 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.empty(); } }); observableConvert = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Completable.complete().toObservable(); } }); observableDedicated = source.concatMapCompletable(new Function() { @Override - public Completable apply(Integer v) - throws Exception { + public Completable apply(Integer v) { return Completable.complete(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java index 0ffbfcd321..b194580fa8 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybeEmptyPerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.empty(); } }); concatMapToObservableEmpty = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Maybe.empty().toObservable(); } }); observableDedicated = source.concatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.empty(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java index 2ec317234b..5c7d6ad7a0 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapMaybePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); observableConvert = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Maybe.just(v).toObservable(); } }); observableDedicated = source.concatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java index e67138c816..1785b59135 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapSinglePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); observableConvert = source.concatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Single.just(v).toObservable(); } }); observableDedicated = source.concatMapSingle(new Function>() { @Override - public Single apply(Integer v) - throws Exception { + public Single apply(Integer v) { return Single.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java index 6fc1ed9b07..64247ac219 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapCompletablePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.empty(); } }); observableConvert = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Completable.complete().toObservable(); } }); observableDedicated = source.flatMapCompletable(new Function() { @Override - public Completable apply(Integer v) - throws Exception { + public Completable apply(Integer v) { return Completable.complete(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java index d1b8dea70a..5e38b30061 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybeEmptyPerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.empty(); } }); observableConvert = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Maybe.empty().toObservable(); } }); observableDedicated = source.flatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.empty(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java index 37bf095ce5..ffc5b15e56 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapMaybePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); observableConvert = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Maybe.just(v).toObservable(); } }); observableDedicated = source.flatMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java index 6139e6e080..6356ad8ace 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableFlatMapSinglePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); observableConvert = source.flatMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Single.just(v).toObservable(); } }); observableDedicated = source.flatMapSingle(new Function>() { @Override - public Single apply(Integer v) - throws Exception { + public Single apply(Integer v) { return Single.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java index 7f91a83adf..1fc6eef9b3 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapCompletablePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.empty(); } }); observableConvert = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Completable.complete().toObservable(); } }); observableDedicated = source.switchMapCompletable(new Function() { @Override - public Completable apply(Integer v) - throws Exception { + public Completable apply(Integer v) { return Completable.complete(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java index 967a244b07..4737493420 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybeEmptyPerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.empty(); } }); observableConvert = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Maybe.empty().toObservable(); } }); observableDedicated = source.switchMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.empty(); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java index 123e88b921..b8dca2d95b 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapMaybePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); observableConvert = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Maybe.just(v).toObservable(); } }); observableDedicated = source.switchMapMaybe(new Function>() { @Override - public Maybe apply(Integer v) - throws Exception { + public Maybe apply(Integer v) { return Maybe.just(v); } }); diff --git a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java index abe4ea45b3..682e2712f0 100644 --- a/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java +++ b/src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableSwitchMapSinglePerf.java @@ -47,24 +47,21 @@ public void setup() { observablePlain = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Observable.just(v); } }); observableConvert = source.switchMap(new Function>() { @Override - public Observable apply(Integer v) - throws Exception { + public Observable apply(Integer v) { return Single.just(v).toObservable(); } }); observableDedicated = source.switchMapSingle(new Function>() { @Override - public Single apply(Integer v) - throws Exception { + public Single apply(Integer v) { return Single.just(v); } }); diff --git a/src/main/java/io/reactivex/rxjava3/core/Completable.java b/src/main/java/io/reactivex/rxjava3/core/Completable.java index 00591742e4..9ce0ee1df8 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Completable.java +++ b/src/main/java/io/reactivex/rxjava3/core/Completable.java @@ -1844,7 +1844,7 @@ public final Completable lift(@NonNull CompletableOperator onLift) { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Single> materialize() { - return RxJavaPlugins.onAssembly(new CompletableMaterialize(this)); + return RxJavaPlugins.onAssembly(new CompletableMaterialize<>(this)); } /** @@ -2239,7 +2239,7 @@ public final Completable startWith(@NonNull CompletableSource other) { @SchedulerSupport(SchedulerSupport.NONE) public final Observable startWith(@NonNull ObservableSource other) { Objects.requireNonNull(other, "other is null"); - return Observable.wrap(other).concatWith(this.toObservable()); + return Observable.wrap(other).concatWith(this.toObservable()); } /** * Returns a Flowable which first delivers the events @@ -2637,7 +2637,7 @@ public final Flowable toFlowable() { if (this instanceof FuseToFlowable) { return ((FuseToFlowable)this).fuseToFlowable(); } - return RxJavaPlugins.onAssembly(new CompletableToFlowable(this)); + return RxJavaPlugins.onAssembly(new CompletableToFlowable<>(this)); } /** @@ -2661,7 +2661,7 @@ public final Maybe toMaybe() { if (this instanceof FuseToMaybe) { return ((FuseToMaybe)this).fuseToMaybe(); } - return RxJavaPlugins.onAssembly(new MaybeFromCompletable(this)); + return RxJavaPlugins.onAssembly(new MaybeFromCompletable<>(this)); } /** @@ -2684,7 +2684,7 @@ public final Observable toObservable() { if (this instanceof FuseToObservable) { return ((FuseToObservable)this).fuseToObservable(); } - return RxJavaPlugins.onAssembly(new CompletableToObservable(this)); + return RxJavaPlugins.onAssembly(new CompletableToObservable<>(this)); } /** @@ -2706,7 +2706,7 @@ public final Observable toObservable() { @SchedulerSupport(SchedulerSupport.NONE) public final <@NonNull T> Single toSingle(@NonNull Supplier completionValueSupplier) { Objects.requireNonNull(completionValueSupplier, "completionValueSupplier is null"); - return RxJavaPlugins.onAssembly(new CompletableToSingle(this, completionValueSupplier, null)); + return RxJavaPlugins.onAssembly(new CompletableToSingle<>(this, completionValueSupplier, null)); } /** @@ -2848,7 +2848,7 @@ public static Completable fromCompletionStage(@NonNull CompletionStage stage) * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}. *

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).toCompletionStage(Optional.empty());
diff --git a/src/main/java/io/reactivex/rxjava3/core/Flowable.java b/src/main/java/io/reactivex/rxjava3/core/Flowable.java
index df3a8a270a..97785c1f4c 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Flowable.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Flowable.java
@@ -332,7 +332,7 @@ public static  Flowable combineLatestArray(@NonNull Publisher(sources, combiner, bufferSize, false));
+        return RxJavaPlugins.onAssembly(new FlowableCombineLatest<>(sources, combiner, bufferSize, false));
     }
 
     /**
@@ -429,7 +429,7 @@ public static  Flowable combineLatest(@NonNull Iterable(sources, combiner, bufferSize, false));
+        return RxJavaPlugins.onAssembly(new FlowableCombineLatest<>(sources, combiner, bufferSize, false));
     }
 
     /**
@@ -530,7 +530,7 @@ public static  Flowable combineLatest(@NonNull Iterable(sources, combiner, bufferSize, true));
+        return RxJavaPlugins.onAssembly(new FlowableCombineLatest<>(sources, combiner, bufferSize, true));
     }
 
     /**
@@ -629,7 +629,7 @@ public static  Flowable combineLatestDelayError(@NonNull Iterable(sources, combiner, bufferSize, true));
+        return RxJavaPlugins.onAssembly(new FlowableCombineLatest<>(sources, combiner, bufferSize, true));
     }
 
     /**
@@ -1892,7 +1892,7 @@ public static  Flowable empty() {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Flowable error(@NonNull Supplier supplier) {
         Objects.requireNonNull(supplier, "supplier is null");
-        return RxJavaPlugins.onAssembly(new FlowableError(supplier));
+        return RxJavaPlugins.onAssembly(new FlowableError<>(supplier));
     }
 
     /**
@@ -1997,7 +1997,7 @@ public static  Flowable error(@NonNull Throwable throwable) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Flowable fromCallable(@NonNull Callable supplier) {
         Objects.requireNonNull(supplier, "supplier is null");
-        return RxJavaPlugins.onAssembly(new FlowableFromCallable(supplier));
+        return RxJavaPlugins.onAssembly(new FlowableFromCallable<>(supplier));
     }
 
     /**
@@ -2039,7 +2039,7 @@ public static  Flowable error(@NonNull Throwable throwable) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Flowable fromFuture(@NonNull Future future) {
         Objects.requireNonNull(future, "future is null");
-        return RxJavaPlugins.onAssembly(new FlowableFromFuture(future, 0L, null));
+        return RxJavaPlugins.onAssembly(new FlowableFromFuture<>(future, 0L, null));
     }
 
     /**
@@ -2086,7 +2086,7 @@ public static  Flowable error(@NonNull Throwable throwable) {
     public static <@NonNull T> Flowable fromFuture(@NonNull Future future, long timeout, @NonNull TimeUnit unit) {
         Objects.requireNonNull(future, "future is null");
         Objects.requireNonNull(unit, "unit is null");
-        return RxJavaPlugins.onAssembly(new FlowableFromFuture(future, timeout, unit));
+        return RxJavaPlugins.onAssembly(new FlowableFromFuture<>(future, timeout, unit));
     }
 
     /**
@@ -2205,7 +2205,7 @@ public static  Flowable error(@NonNull Throwable throwable) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Flowable fromIterable(@NonNull Iterable source) {
         Objects.requireNonNull(source, "source is null");
-        return RxJavaPlugins.onAssembly(new FlowableFromIterable(source));
+        return RxJavaPlugins.onAssembly(new FlowableFromIterable<>(source));
     }
 
     /**
@@ -2246,7 +2246,7 @@ public static  Flowable fromPublisher(@NonNull Publisher sour
         }
         Objects.requireNonNull(source, "source is null");
 
-        return RxJavaPlugins.onAssembly(new FlowableFromPublisher(source));
+        return RxJavaPlugins.onAssembly(new FlowableFromPublisher<>(source));
     }
 
     /**
@@ -2287,7 +2287,7 @@ public static  Flowable fromPublisher(@NonNull Publisher sour
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Flowable fromSupplier(@NonNull Supplier supplier) {
         Objects.requireNonNull(supplier, "supplier is null");
-        return RxJavaPlugins.onAssembly(new FlowableFromSupplier(supplier));
+        return RxJavaPlugins.onAssembly(new FlowableFromSupplier<>(supplier));
     }
 
     /**
@@ -2318,7 +2318,7 @@ public static  Flowable fromPublisher(@NonNull Publisher sour
     public static  Flowable generate(@NonNull Consumer<@NonNull Emitter> generator) {
         Objects.requireNonNull(generator, "generator is null");
         return generate(Functions.nullSupplier(),
-                FlowableInternalHelper.simpleGenerator(generator),
+                FlowableInternalHelper.simpleGenerator(generator),
                 Functions.emptyConsumer());
     }
 
@@ -2351,7 +2351,7 @@ public static  Flowable generate(@NonNull Consumer<@NonNull Emitter> ge
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Flowable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator) {
         Objects.requireNonNull(generator, "generator is null");
-        return generate(initialState, FlowableInternalHelper.simpleBiGenerator(generator),
+        return generate(initialState, FlowableInternalHelper.simpleBiGenerator(generator),
                 Functions.emptyConsumer());
     }
 
@@ -2387,7 +2387,7 @@ public static  Flowable generate(@NonNull Supplier initialState, @No
     public static  Flowable generate(@NonNull Supplier initialState, @NonNull BiConsumer> generator,
             @NonNull Consumer disposeState) {
         Objects.requireNonNull(generator, "generator is null");
-        return generate(initialState, FlowableInternalHelper.simpleBiGenerator(generator), disposeState);
+        return generate(initialState, FlowableInternalHelper.simpleBiGenerator(generator), disposeState);
     }
 
     /**
@@ -4622,7 +4622,7 @@ public static  Flowable using(
     public static  Flowable zip(@NonNull Iterable> sources, @NonNull Function zipper) {
         Objects.requireNonNull(zipper, "zipper is null");
         Objects.requireNonNull(sources, "sources is null");
-        return RxJavaPlugins.onAssembly(new FlowableZip(null, sources, zipper, bufferSize(), false));
+        return RxJavaPlugins.onAssembly(new FlowableZip<>(null, sources, zipper, bufferSize(), false));
     }
 
     /**
@@ -4684,7 +4684,7 @@ public static  Flowable zip(@NonNull Iterable(null, sources, zipper, bufferSize, delayError));
+        return RxJavaPlugins.onAssembly(new FlowableZip<>(null, sources, zipper, bufferSize, delayError));
     }
 
     /**
@@ -5486,7 +5486,7 @@ public static  Flowable zipArray(@NonNull Function(sources, null, zipper, bufferSize, delayError));
+        return RxJavaPlugins.onAssembly(new FlowableZip<>(sources, null, zipper, bufferSize, delayError));
     }
 
     // ***************************************************************************************************
@@ -6025,7 +6025,7 @@ public final T blockingSingle(@NonNull T defaultItem) {
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public final Future toFuture() {
-        return subscribeWith(new FutureSubscriber());
+        return subscribeWith(new FutureSubscriber<>());
     }
 
     /**
@@ -6303,7 +6303,7 @@ public final Flowable> buffer(int count) {
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public final Flowable> buffer(int count, int skip) {
-        return buffer(count, skip, ArrayListSupplier.asSupplier());
+        return buffer(count, skip, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -6415,7 +6415,7 @@ public final > Flowable buffer(int count, @No
     @SchedulerSupport(SchedulerSupport.COMPUTATION)
     @NonNull
     public final Flowable> buffer(long timespan, long timeskip, @NonNull TimeUnit unit) {
-        return buffer(timespan, timeskip, unit, Schedulers.computation(), ArrayListSupplier.asSupplier());
+        return buffer(timespan, timeskip, unit, Schedulers.computation(), ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -6453,7 +6453,7 @@ public final Flowable> buffer(long timespan, long timeskip, @NonNull Tim
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public final Flowable> buffer(long timespan, long timeskip, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
-        return buffer(timespan, timeskip, unit, scheduler, ArrayListSupplier.asSupplier());
+        return buffer(timespan, timeskip, unit, scheduler, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -6610,7 +6610,7 @@ public final Flowable> buffer(long timespan, @NonNull TimeUnit unit, int
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public final Flowable> buffer(long timespan, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, int count) {
-        return buffer(timespan, unit, scheduler, count, ArrayListSupplier.asSupplier(), false);
+        return buffer(timespan, unit, scheduler, count, ArrayListSupplier.asSupplier(), false);
     }
 
     /**
@@ -6700,7 +6700,7 @@ public final > Flowable buffer(
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public final Flowable> buffer(long timespan, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
-        return buffer(timespan, unit, scheduler, Integer.MAX_VALUE, ArrayListSupplier.asSupplier(), false);
+        return buffer(timespan, unit, scheduler, Integer.MAX_VALUE, ArrayListSupplier.asSupplier(), false);
     }
 
     /**
@@ -6737,7 +6737,7 @@ public final Flowable> buffer(long timespan, @NonNull TimeUnit unit, @No
     public final  Flowable> buffer(
             @NonNull Flowable openingIndicator,
             @NonNull Function> closingIndicator) {
-        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.asSupplier());
+        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -6817,7 +6817,7 @@ public final > Flowable b
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public final  Flowable> buffer(@NonNull Publisher boundaryIndicator) {
-        return buffer(boundaryIndicator, ArrayListSupplier.asSupplier());
+        return buffer(boundaryIndicator, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -6855,7 +6855,7 @@ public final  Flowable> buffer(@NonNull Publisher boundaryIndicato
     @NonNull
     public final  Flowable> buffer(@NonNull Publisher boundaryIndicator, int initialCapacity) {
         ObjectHelper.verifyPositive(initialCapacity, "initialCapacity");
-        return buffer(boundaryIndicator, Functions.createArrayList(initialCapacity));
+        return buffer(boundaryIndicator, Functions.createArrayList(initialCapacity));
     }
 
     /**
@@ -7089,7 +7089,7 @@ public final  Flowable cast(@NonNull Class clazz) {
     public final  Single collect(@NonNull Supplier initialItemSupplier, @NonNull BiConsumer collector) {
         Objects.requireNonNull(initialItemSupplier, "initialItemSupplier is null");
         Objects.requireNonNull(collector, "collector is null");
-        return RxJavaPlugins.onAssembly(new FlowableCollectSingle(this, initialItemSupplier, collector));
+        return RxJavaPlugins.onAssembly(new FlowableCollectSingle<>(this, initialItemSupplier, collector));
     }
 
     /**
@@ -8896,7 +8896,7 @@ public final Flowable distinct() {
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public final  Flowable distinct(@NonNull Function keySelector) {
-        return distinct(keySelector, Functions.createHashSet());
+        return distinct(keySelector, Functions.createHashSet());
     }
 
     /**
@@ -9063,7 +9063,7 @@ public final  Flowable distinctUntilChanged(@NonNull Function distinctUntilChanged(@NonNull BiPredicate comparer) {
         Objects.requireNonNull(comparer, "comparer is null");
-        return RxJavaPlugins.onAssembly(new FlowableDistinctUntilChanged<>(this, Functions.identity(), comparer));
+        return RxJavaPlugins.onAssembly(new FlowableDistinctUntilChanged<>(this, Functions.identity(), comparer));
     }
 
     /**
@@ -10632,7 +10632,7 @@ public final Disposable forEachWhile(@NonNull Predicate onNext, @NonN
      * Note also that ignoring groups or subscribing later (i.e., on another thread) will result in
      * so-called group abandonment where a group will only contain one element and the group will be
      * re-created over and over as new upstream items trigger a new group. The behavior is
-     * a tradeoff between no-dataloss, upstream cancellation and excessive group creation.
+     * a trade-off between no-dataloss, upstream cancellation and excessive group creation.
      *
      * 
*
Backpressure:
@@ -10664,7 +10664,7 @@ public final Disposable forEachWhile(@NonNull Predicate onNext, @NonN @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Flowable> groupBy(@NonNull Function keySelector) { - return groupBy(keySelector, Functions.identity(), false, bufferSize()); + return groupBy(keySelector, Functions.identity(), false, bufferSize()); } /** @@ -10691,7 +10691,7 @@ public final Flowable> groupBy(@NonNull Function *
Backpressure:
@@ -10724,7 +10724,7 @@ public final Flowable> groupBy(@NonNull Function Flowable> groupBy(@NonNull Function keySelector, boolean delayError) { - return groupBy(keySelector, Functions.identity(), delayError, bufferSize()); + return groupBy(keySelector, Functions.identity(), delayError, bufferSize()); } /** @@ -10751,7 +10751,7 @@ public final Flowable> groupBy(@NonNull Function *
Backpressure:
@@ -10816,7 +10816,7 @@ public final Flowable> groupBy(@NonNull Function *
Backpressure:
@@ -10882,7 +10882,7 @@ public final Flowable> groupBy(@NonNull Function *
Backpressure:
@@ -10927,7 +10927,7 @@ public final Flowable> groupBy(@NonNull Function(this, keySelector, valueSelector, bufferSize, delayError, null)); + return RxJavaPlugins.onAssembly(new FlowableGroupBy<>(this, keySelector, valueSelector, bufferSize, delayError, null)); } /** @@ -10995,7 +10995,7 @@ public final Flowable> groupBy(@NonNull Function *
Backpressure:
@@ -11050,7 +11050,7 @@ public final Flowable> groupBy(@NonNull Function(this, keySelector, valueSelector, bufferSize, delayError, evictingMapFactory)); + return RxJavaPlugins.onAssembly(new FlowableGroupBy<>(this, keySelector, valueSelector, bufferSize, delayError, evictingMapFactory)); } /** @@ -11100,7 +11100,7 @@ public final Flowable groupJoin( Objects.requireNonNull(leftEnd, "leftEnd is null"); Objects.requireNonNull(rightEnd, "rightEnd is null"); Objects.requireNonNull(resultSelector, "resultSelector is null"); - return RxJavaPlugins.onAssembly(new FlowableGroupJoin( + return RxJavaPlugins.onAssembly(new FlowableGroupJoin<>( this, other, leftEnd, rightEnd, resultSelector)); } @@ -11456,7 +11456,7 @@ public final Single lastOrError() { @SchedulerSupport(SchedulerSupport.NONE) public final Flowable lift(@NonNull FlowableOperator lifter) { Objects.requireNonNull(lifter, "lifter is null"); - return RxJavaPlugins.onAssembly(new FlowableLift(this, lifter)); + return RxJavaPlugins.onAssembly(new FlowableLift<>(this, lifter)); } /** @@ -11486,7 +11486,7 @@ public final Flowable lift(@NonNull FlowableOperator Flowable map(@NonNull Function mapper) { Objects.requireNonNull(mapper, "mapper is null"); - return RxJavaPlugins.onAssembly(new FlowableMap(this, mapper)); + return RxJavaPlugins.onAssembly(new FlowableMap<>(this, mapper)); } /** @@ -13894,7 +13894,7 @@ public final void safeSubscribe(@NonNull Subscriber s) { if (s instanceof SafeSubscriber) { subscribe((SafeSubscriber)s); } else { - subscribe(new SafeSubscriber(s)); + subscribe(new SafeSubscriber<>(s)); } } @@ -14768,7 +14768,7 @@ public final Flowable skipWhile(@NonNull Predicate predicate) { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Flowable sorted() { - return toList().toFlowable().map(Functions.listSorter(Functions.naturalComparator())).flatMapIterable(Functions.>identity()); + return toList().toFlowable().map(Functions.listSorter(Functions.naturalComparator())).flatMapIterable(Functions.identity()); } /** @@ -14797,7 +14797,7 @@ public final Flowable sorted() { @SchedulerSupport(SchedulerSupport.NONE) public final Flowable sorted(@NonNull Comparator<@NonNull ? super T> sortFunction) { Objects.requireNonNull(sortFunction, "sortFunction"); - return toList().toFlowable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.>identity()); + return toList().toFlowable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.identity()); } /** @@ -15065,7 +15065,7 @@ public final void subscribe(@NonNull Subscriber s) { subscribe((FlowableSubscriber)s); } else { Objects.requireNonNull(s, "s is null"); - subscribe(new StrictSubscriber(s)); + subscribe(new StrictSubscriber<>(s)); } } @@ -17119,7 +17119,7 @@ public final Flowable> timestamp(@NonNull TimeUnit unit) { public final Flowable> timestamp(@NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return map(Functions.timestampWith(unit, scheduler)); + return map(Functions.timestampWith(unit, scheduler)); } /** @@ -17178,7 +17178,7 @@ public final R to(@NonNull FlowableConverter converter) { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Single> toList() { - return RxJavaPlugins.onAssembly(new FlowableToListSingle>(this)); + return RxJavaPlugins.onAssembly(new FlowableToListSingle<>(this)); } /** @@ -17216,7 +17216,7 @@ public final Single> toList() { @NonNull public final Single> toList(int capacityHint) { ObjectHelper.verifyPositive(capacityHint, "capacityHint"); - return RxJavaPlugins.onAssembly(new FlowableToListSingle<>(this, Functions.createArrayList(capacityHint))); + return RxJavaPlugins.onAssembly(new FlowableToListSingle<>(this, Functions.createArrayList(capacityHint))); } /** @@ -17290,7 +17290,7 @@ public final > Single toList(@NonNull Supplie @SchedulerSupport(SchedulerSupport.NONE) public final Single> toMap(@NonNull Function keySelector) { Objects.requireNonNull(keySelector, "keySelector is null"); - return collect(HashMapSupplier.asSupplier(), Functions.toMapKeySelector(keySelector)); + return collect(HashMapSupplier.asSupplier(), Functions.toMapKeySelector(keySelector)); } /** @@ -17330,7 +17330,7 @@ public final Single> toMap(@NonNull Function Single> toMap(@NonNull Function keySelector, @NonNull Function valueSelector) { Objects.requireNonNull(keySelector, "keySelector is null"); Objects.requireNonNull(valueSelector, "valueSelector is null"); - return collect(HashMapSupplier.asSupplier(), Functions.toMapKeyValueSelector(keySelector, valueSelector)); + return collect(HashMapSupplier.asSupplier(), Functions.toMapKeyValueSelector(keySelector, valueSelector)); } /** @@ -17533,7 +17533,7 @@ public final Single>> toMultimap( @NonNull Function valueSelector, @NonNull Supplier>> mapSupplier ) { - return toMultimap(keySelector, valueSelector, mapSupplier, ArrayListSupplier.asFunction()); + return toMultimap(keySelector, valueSelector, mapSupplier, ArrayListSupplier.asFunction()); } /** @@ -17731,7 +17731,7 @@ public final Flowable unsubscribeOn(@NonNull Scheduler scheduler) { *

* Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window will only contain one element. The behavior is - * a tradeoff between no-dataloss and ensuring upstream cancellation can happen. + * a trade-off between no-dataloss and ensuring upstream cancellation can happen. *

*
Backpressure:
*
The operator honors backpressure of its inner and outer subscribers, however, the inner Publisher uses an @@ -17766,7 +17766,7 @@ public final Flowable> window(long count) { * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff between no-dataloss and ensuring upstream cancellation can happen under some race conditions. + * a trade-off between no-dataloss and ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator honors backpressure of its inner and outer subscribers, however, the inner Publisher uses an @@ -17804,7 +17804,7 @@ public final Flowable> window(long count, long skip) { * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff between no-dataloss and ensuring upstream cancellation can happen under some race conditions. + * a trade-off between no-dataloss and ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator honors backpressure of its inner and outer subscribers, however, the inner Publisher uses an @@ -17848,7 +17848,7 @@ public final Flowable> window(long count, long skip, int bufferSize) * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -17889,7 +17889,7 @@ public final Flowable> window(long timespan, long timeskip, @NonNull * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -17932,7 +17932,7 @@ public final Flowable> window(long timespan, long timeskip, @NonNull * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -17981,7 +17981,7 @@ public final Flowable> window(long timespan, long timeskip, @NonNull * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -18021,7 +18021,7 @@ public final Flowable> window(long timespan, @NonNull TimeUnit unit) * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -18065,7 +18065,7 @@ public final Flowable> window(long timespan, @NonNull TimeUnit unit, * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -18110,7 +18110,7 @@ public final Flowable> window(long timespan, @NonNull TimeUnit unit, * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -18154,7 +18154,7 @@ public final Flowable> window(long timespan, @NonNull TimeUnit unit, * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -18200,7 +18200,7 @@ public final Flowable> window(long timespan, @NonNull TimeUnit unit, * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -18248,7 +18248,7 @@ public final Flowable> window(long timespan, @NonNull TimeUnit unit, * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The operator consumes the source {@code Publisher} in an unbounded manner. @@ -18301,7 +18301,7 @@ public final Flowable> window( * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The outer Publisher of this operator does not support backpressure as it uses a {@code boundary} Publisher to control data @@ -18337,7 +18337,7 @@ public final Flowable> window(@NonNull Publisher boundaryIndi * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The outer Publisher of this operator does not support backpressure as it uses a {@code boundary} Publisher to control data @@ -18378,7 +18378,7 @@ public final Flowable> window(@NonNull Publisher boundaryIndi * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The outer Publisher of this operator doesn't support backpressure because the emission of new @@ -18421,7 +18421,7 @@ public final Flowable> window( * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Backpressure:
*
The outer Publisher of this operator doesn't support backpressure because the emission of new @@ -18731,7 +18731,7 @@ public final Flowable withLatestFrom(@NonNull Iterable Flowable zipWith(@NonNull Iterable other, @NonNull BiFunction zipper) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(zipper, "zipper is null"); - return RxJavaPlugins.onAssembly(new FlowableZipIterable(this, other, zipper)); + return RxJavaPlugins.onAssembly(new FlowableZipIterable<>(this, other, zipper)); } /** @@ -19154,7 +19154,7 @@ public final TestSubscriber test(long initialRequest, boolean cancel) { // No * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}. *

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).firstStage(Optional.empty());
@@ -19191,7 +19191,7 @@ public final CompletionStage firstStage(@Nullable T defaultItem) {
      * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and
      * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}.
      * 

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).singleStage(Optional.empty());
@@ -19227,7 +19227,7 @@ public final CompletionStage singleStage(@Nullable T defaultItem) {
      * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and
      * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}.
      * 

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).lastStage(Optional.empty());
@@ -19409,7 +19409,7 @@ public final Stream blockingStream() {
     public final Stream blockingStream(int prefetch) {
         Iterator iterator = blockingIterable(prefetch).iterator();
         return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false)
-                .onClose(() -> ((Disposable)iterator).dispose());
+                .onClose(((Disposable) iterator)::dispose);
     }
 
     /**
diff --git a/src/main/java/io/reactivex/rxjava3/core/Maybe.java b/src/main/java/io/reactivex/rxjava3/core/Maybe.java
index f26e584c16..dfe8c4f0b4 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Maybe.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Maybe.java
@@ -653,7 +653,7 @@ public static  Maybe empty() {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Maybe error(@NonNull Throwable exception) {
         Objects.requireNonNull(exception, "exception is null");
-        return RxJavaPlugins.onAssembly(new MaybeError(exception));
+        return RxJavaPlugins.onAssembly(new MaybeError<>(exception));
     }
 
     /**
@@ -679,7 +679,7 @@ public static  Maybe error(@NonNull Throwable exception) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Maybe error(@NonNull Supplier supplier) {
         Objects.requireNonNull(supplier, "supplier is null");
-        return RxJavaPlugins.onAssembly(new MaybeErrorCallable(supplier));
+        return RxJavaPlugins.onAssembly(new MaybeErrorCallable<>(supplier));
     }
 
     /**
@@ -706,7 +706,7 @@ public static  Maybe error(@NonNull Supplier supplier
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Maybe fromAction(@NonNull Action run) {
         Objects.requireNonNull(run, "run is null");
-        return RxJavaPlugins.onAssembly(new MaybeFromAction(run));
+        return RxJavaPlugins.onAssembly(new MaybeFromAction<>(run));
     }
 
     /**
@@ -726,7 +726,7 @@ public static  Maybe fromAction(@NonNull Action run) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Maybe fromCompletable(@NonNull CompletableSource completableSource) {
         Objects.requireNonNull(completableSource, "completableSource is null");
-        return RxJavaPlugins.onAssembly(new MaybeFromCompletable(completableSource));
+        return RxJavaPlugins.onAssembly(new MaybeFromCompletable<>(completableSource));
     }
 
     /**
@@ -790,7 +790,7 @@ public static  Maybe fromSingle(@NonNull SingleSource singleSource) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Maybe fromCallable(@NonNull Callable callable) {
         Objects.requireNonNull(callable, "callable is null");
-        return RxJavaPlugins.onAssembly(new MaybeFromCallable(callable));
+        return RxJavaPlugins.onAssembly(new MaybeFromCallable<>(callable));
     }
 
     /**
@@ -824,7 +824,7 @@ public static  Maybe fromSingle(@NonNull SingleSource singleSource) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Maybe fromFuture(@NonNull Future future) {
         Objects.requireNonNull(future, "future is null");
-        return RxJavaPlugins.onAssembly(new MaybeFromFuture(future, 0L, null));
+        return RxJavaPlugins.onAssembly(new MaybeFromFuture<>(future, 0L, null));
     }
 
     /**
@@ -863,7 +863,7 @@ public static  Maybe fromSingle(@NonNull SingleSource singleSource) {
     public static <@NonNull T> Maybe fromFuture(@NonNull Future future, long timeout, @NonNull TimeUnit unit) {
         Objects.requireNonNull(future, "future is null");
         Objects.requireNonNull(unit, "unit is null");
-        return RxJavaPlugins.onAssembly(new MaybeFromFuture(future, timeout, unit));
+        return RxJavaPlugins.onAssembly(new MaybeFromFuture<>(future, timeout, unit));
     }
 
     /**
@@ -883,7 +883,7 @@ public static  Maybe fromSingle(@NonNull SingleSource singleSource) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Maybe fromRunnable(@NonNull Runnable run) {
         Objects.requireNonNull(run, "run is null");
-        return RxJavaPlugins.onAssembly(new MaybeFromRunnable(run));
+        return RxJavaPlugins.onAssembly(new MaybeFromRunnable<>(run));
     }
 
     /**
@@ -930,7 +930,7 @@ public static  Maybe fromRunnable(@NonNull Runnable run) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Maybe fromSupplier(@NonNull Supplier supplier) {
         Objects.requireNonNull(supplier, "supplier is null");
-        return RxJavaPlugins.onAssembly(new MaybeFromSupplier(supplier));
+        return RxJavaPlugins.onAssembly(new MaybeFromSupplier<>(supplier));
     }
 
     /**
@@ -1865,7 +1865,7 @@ public static  Maybe wrap(@NonNull MaybeSource source) {
     public static  Maybe zip(@NonNull Iterable> sources, @NonNull Function zipper) {
         Objects.requireNonNull(zipper, "zipper is null");
         Objects.requireNonNull(sources, "sources is null");
-        return RxJavaPlugins.onAssembly(new MaybeZipIterable(sources, zipper));
+        return RxJavaPlugins.onAssembly(new MaybeZipIterable<>(sources, zipper));
     }
 
     /**
@@ -2331,7 +2331,7 @@ public static  Maybe zipArray(@NonNull Function(sources, zipper));
+        return RxJavaPlugins.onAssembly(new MaybeZipArray<>(sources, zipper));
     }
 
     // ------------------------------------------------------------------
@@ -3530,7 +3530,7 @@ public final Single isEmpty() {
     @SchedulerSupport(SchedulerSupport.NONE)
     public final  Maybe lift(@NonNull MaybeOperator lift) {
         Objects.requireNonNull(lift, "lift is null");
-        return RxJavaPlugins.onAssembly(new MaybeLift(this, lift));
+        return RxJavaPlugins.onAssembly(new MaybeLift<>(this, lift));
     }
 
     /**
@@ -3554,7 +3554,7 @@ public final  Maybe lift(@NonNull MaybeOperator li
     @SchedulerSupport(SchedulerSupport.NONE)
     public final  Maybe map(@NonNull Function mapper) {
         Objects.requireNonNull(mapper, "mapper is null");
-        return RxJavaPlugins.onAssembly(new MaybeMap(this, mapper));
+        return RxJavaPlugins.onAssembly(new MaybeMap<>(this, mapper));
     }
 
     /**
@@ -4349,7 +4349,7 @@ public final Disposable subscribe(@NonNull Consumer onSuccess, @NonNu
         Objects.requireNonNull(onSuccess, "onSuccess is null");
         Objects.requireNonNull(onError, "onError is null");
         Objects.requireNonNull(onComplete, "onComplete is null");
-        return subscribeWith(new MaybeCallbackObserver(onSuccess, onError, onComplete));
+        return subscribeWith(new MaybeCallbackObserver<>(onSuccess, onError, onComplete));
     }
 
     @SchedulerSupport(SchedulerSupport.NONE)
@@ -4925,7 +4925,7 @@ public final TestObserver test(boolean dispose) {
      *  
{@code mapOptional} does not operate by default on a particular {@link Scheduler}.
*
* @param the non-null output type - * @param mapper the function that receives the upstream success iteem and should return a non-empty {@code Optional} + * @param mapper the function that receives the upstream success item and should return a non-empty {@code Optional} * to emit as the success output or an empty {@code Optional} to complete the {@code Maybe} * @return the new Maybe instance * @since 3.0.0 @@ -4952,8 +4952,8 @@ public final TestObserver test(boolean dispose) { * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}. *

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use - * {@link #toCompletionStage(Object)} with {@code null} or turn the upstrea into a sequence of {@link Optional}s and + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use + * {@link #toCompletionStage(Object)} with {@code null} or turn the upstream into a sequence of {@link Optional}s and * default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).toCompletionStage(Optional.empty());
@@ -4985,7 +4985,7 @@ public final CompletionStage toCompletionStage() {
      * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and
      * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}.
      * 

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).toCompletionStage(Optional.empty());
diff --git a/src/main/java/io/reactivex/rxjava3/core/Observable.java b/src/main/java/io/reactivex/rxjava3/core/Observable.java
index 1933a6db0b..373a576888 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Observable.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Observable.java
@@ -265,7 +265,7 @@ public static  Observable combineLatest(
 
         // the queue holds a pair of values so we need to double the capacity
         int s = bufferSize << 1;
-        return RxJavaPlugins.onAssembly(new ObservableCombineLatest(null, sources, combiner, s, false));
+        return RxJavaPlugins.onAssembly(new ObservableCombineLatest<>(null, sources, combiner, s, false));
     }
 
     /**
@@ -364,7 +364,7 @@ public static  Observable combineLatestArray(
 
         // the queue holds a pair of values so we need to double the capacity
         int s = bufferSize << 1;
-        return RxJavaPlugins.onAssembly(new ObservableCombineLatest(sources, null, combiner, s, false));
+        return RxJavaPlugins.onAssembly(new ObservableCombineLatest<>(sources, null, combiner, s, false));
     }
 
     /**
@@ -917,7 +917,7 @@ public static  Observable combineLatestDelayError(@NonNull ObservableSo
         }
         // the queue holds a pair of values so we need to double the capacity
         int s = bufferSize << 1;
-        return RxJavaPlugins.onAssembly(new ObservableCombineLatest(sources, null, combiner, s, true));
+        return RxJavaPlugins.onAssembly(new ObservableCombineLatest<>(sources, null, combiner, s, true));
     }
 
     /**
@@ -1013,7 +1013,7 @@ public static  Observable combineLatestDelayError(@NonNull Iterable(null, sources, combiner, s, true));
+        return RxJavaPlugins.onAssembly(new ObservableCombineLatest<>(null, sources, combiner, s, true));
     }
 
     /**
@@ -1669,7 +1669,7 @@ public static  Observable empty() {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Observable error(@NonNull Supplier errorSupplier) {
         Objects.requireNonNull(errorSupplier, "errorSupplier is null");
-        return RxJavaPlugins.onAssembly(new ObservableError(errorSupplier));
+        return RxJavaPlugins.onAssembly(new ObservableError<>(errorSupplier));
     }
 
     /**
@@ -1763,7 +1763,7 @@ public static  Observable fromArray(@NonNull T... items) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Observable fromCallable(@NonNull Callable supplier) {
         Objects.requireNonNull(supplier, "supplier is null");
-        return RxJavaPlugins.onAssembly(new ObservableFromCallable(supplier));
+        return RxJavaPlugins.onAssembly(new ObservableFromCallable<>(supplier));
     }
 
     /**
@@ -1797,7 +1797,7 @@ public static  Observable fromCallable(@NonNull Callable supp
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Observable fromFuture(@NonNull Future future) {
         Objects.requireNonNull(future, "future is null");
-        return RxJavaPlugins.onAssembly(new ObservableFromFuture(future, 0L, null));
+        return RxJavaPlugins.onAssembly(new ObservableFromFuture<>(future, 0L, null));
     }
 
     /**
@@ -1836,7 +1836,7 @@ public static  Observable fromFuture(@NonNull Future future)
     public static  Observable fromFuture(@NonNull Future future, long timeout, @NonNull TimeUnit unit) {
         Objects.requireNonNull(future, "future is null");
         Objects.requireNonNull(unit, "unit is null");
-        return RxJavaPlugins.onAssembly(new ObservableFromFuture(future, timeout, unit));
+        return RxJavaPlugins.onAssembly(new ObservableFromFuture<>(future, timeout, unit));
     }
 
     /**
@@ -1940,7 +1940,7 @@ public static  Observable fromFuture(@NonNull Future future,
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Observable fromIterable(@NonNull Iterable source) {
         Objects.requireNonNull(source, "source is null");
-        return RxJavaPlugins.onAssembly(new ObservableFromIterable(source));
+        return RxJavaPlugins.onAssembly(new ObservableFromIterable<>(source));
     }
 
     /**
@@ -1977,7 +1977,7 @@ public static  Observable fromIterable(@NonNull Iterable sour
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Observable fromPublisher(@NonNull Publisher publisher) {
         Objects.requireNonNull(publisher, "publisher is null");
-        return RxJavaPlugins.onAssembly(new ObservableFromPublisher(publisher));
+        return RxJavaPlugins.onAssembly(new ObservableFromPublisher<>(publisher));
     }
 
     /**
@@ -2014,7 +2014,7 @@ public static  Observable fromPublisher(@NonNull Publisher pu
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Observable fromSupplier(@NonNull Supplier supplier) {
         Objects.requireNonNull(supplier, "supplier is null");
-        return RxJavaPlugins.onAssembly(new ObservableFromSupplier(supplier));
+        return RxJavaPlugins.onAssembly(new ObservableFromSupplier<>(supplier));
     }
 
     /**
@@ -2043,8 +2043,8 @@ public static  Observable fromSupplier(@NonNull Supplier supp
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Observable generate(@NonNull Consumer> generator) {
         Objects.requireNonNull(generator, "generator is null");
-        return generate(Functions.nullSupplier(),
-                ObservableInternalHelper.simpleGenerator(generator), Functions.emptyConsumer());
+        return generate(Functions.nullSupplier(),
+                ObservableInternalHelper.simpleGenerator(generator), Functions.emptyConsumer());
     }
 
     /**
@@ -4188,7 +4188,7 @@ public static  Observable wrap(@NonNull ObservableSource source) {
     public static  Observable zip(@NonNull Iterable> sources, @NonNull Function zipper) {
         Objects.requireNonNull(zipper, "zipper is null");
         Objects.requireNonNull(sources, "sources is null");
-        return RxJavaPlugins.onAssembly(new ObservableZip(null, sources, zipper, bufferSize(), false));
+        return RxJavaPlugins.onAssembly(new ObservableZip<>(null, sources, zipper, bufferSize(), false));
     }
 
     /**
@@ -4250,7 +4250,7 @@ public static  Observable zip(@NonNull Iterable(null, sources, zipper, bufferSize, delayError));
+        return RxJavaPlugins.onAssembly(new ObservableZip<>(null, sources, zipper, bufferSize, delayError));
     }
 
     /**
@@ -5004,7 +5004,7 @@ public static  Observable zipArray(
         }
         Objects.requireNonNull(zipper, "zipper is null");
         ObjectHelper.verifyPositive(bufferSize, "bufferSize");
-        return RxJavaPlugins.onAssembly(new ObservableZip(sources, null, zipper, bufferSize, delayError));
+        return RxJavaPlugins.onAssembly(new ObservableZip<>(sources, null, zipper, bufferSize, delayError));
     }
 
     // ***************************************************************************************************
@@ -5477,7 +5477,7 @@ public final T blockingSingle(@NonNull T defaultItem) {
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public final Future toFuture() {
-        return subscribeWith(new FutureObserver());
+        return subscribeWith(new FutureObserver<>());
     }
 
     /**
@@ -5648,7 +5648,7 @@ public final void blockingSubscribe(@NonNull Observer observer) {
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public final Observable<@NonNull List> buffer(int count, int skip) {
-        return buffer(count, skip, ArrayListSupplier.asSupplier());
+        return buffer(count, skip, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -5746,7 +5746,7 @@ public final > Observable buffer(int count, i
     @SchedulerSupport(SchedulerSupport.COMPUTATION)
     @NonNull
     public final Observable<@NonNull List> buffer(long timespan, long timeskip, @NonNull TimeUnit unit) {
-        return buffer(timespan, timeskip, unit, Schedulers.computation(), ArrayListSupplier.asSupplier());
+        return buffer(timespan, timeskip, unit, Schedulers.computation(), ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -5780,7 +5780,7 @@ public final > Observable buffer(int count, i
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public final Observable<@NonNull List> buffer(long timespan, long timeskip, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
-        return buffer(timespan, timeskip, unit, scheduler, ArrayListSupplier.asSupplier());
+        return buffer(timespan, timeskip, unit, scheduler, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -5921,7 +5921,7 @@ public final > Observable buffer(int count, i
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public final Observable<@NonNull List> buffer(long timespan, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, int count) {
-        return buffer(timespan, unit, scheduler, count, ArrayListSupplier.asSupplier(), false);
+        return buffer(timespan, unit, scheduler, count, ArrayListSupplier.asSupplier(), false);
     }
 
     /**
@@ -6003,7 +6003,7 @@ public final > Observable buffer(int count, i
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public final Observable<@NonNull List> buffer(long timespan, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
-        return buffer(timespan, unit, scheduler, Integer.MAX_VALUE, ArrayListSupplier.asSupplier(), false);
+        return buffer(timespan, unit, scheduler, Integer.MAX_VALUE, ArrayListSupplier.asSupplier(), false);
     }
 
     /**
@@ -6036,7 +6036,7 @@ public final > Observable buffer(int count, i
     public final  Observable<@NonNull List> buffer(
             @NonNull ObservableSource openingIndicator,
             @NonNull Function> closingIndicator) {
-        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.asSupplier());
+        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -6108,7 +6108,7 @@ public final > Observable buffer(int count, i
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public final  Observable<@NonNull List> buffer(@NonNull ObservableSource boundary) {
-        return buffer(boundary, ArrayListSupplier.asSupplier());
+        return buffer(boundary, ArrayListSupplier.asSupplier());
     }
 
     /**
@@ -6142,7 +6142,7 @@ public final > Observable buffer(int count, i
     @NonNull
     public final  Observable<@NonNull List> buffer(@NonNull ObservableSource boundary, int initialCapacity) {
         ObjectHelper.verifyPositive(initialCapacity, "initialCapacity");
-        return buffer(boundary, Functions.createArrayList(initialCapacity));
+        return buffer(boundary, Functions.createArrayList(initialCapacity));
     }
 
     /**
@@ -6355,7 +6355,7 @@ public final  Observable cast(@NonNull Class clazz) {
     public final  Single collect(@NonNull Supplier initialValueSupplier, @NonNull BiConsumer collector) {
         Objects.requireNonNull(initialValueSupplier, "initialValueSupplier is null");
         Objects.requireNonNull(collector, "collector is null");
-        return RxJavaPlugins.onAssembly(new ObservableCollectSingle(this, initialValueSupplier, collector));
+        return RxJavaPlugins.onAssembly(new ObservableCollectSingle<>(this, initialValueSupplier, collector));
     }
 
     /**
@@ -8088,7 +8088,7 @@ public final  Observable distinctUntilChanged(@NonNull Function distinctUntilChanged(@NonNull BiPredicate comparer) {
         Objects.requireNonNull(comparer, "comparer is null");
-        return RxJavaPlugins.onAssembly(new ObservableDistinctUntilChanged<>(this, Functions.identity(), comparer));
+        return RxJavaPlugins.onAssembly(new ObservableDistinctUntilChanged<>(this, Functions.identity(), comparer));
     }
 
     /**
@@ -9351,7 +9351,7 @@ public final Disposable forEachWhile(@NonNull Predicate onNext, @NonN
      * Note also that ignoring groups or subscribing later (i.e., on another thread) will result in
      * so-called group abandonment where a group will only contain one element and the group will be
      * re-created over and over as new upstream items trigger a new group. The behavior is
-     * a tradeoff between no-dataloss, upstream cancellation and excessive group creation.
+     * a trade-off between no-dataloss, upstream cancellation and excessive group creation.
      *
      * 
*
Scheduler:
@@ -9392,7 +9392,7 @@ public final Observable> groupBy(@NonNull Function *
Scheduler:
@@ -9436,7 +9436,7 @@ public final Observable> groupBy(@NonNull Function *
Scheduler:
@@ -9481,7 +9481,7 @@ public final Observable> groupBy(@NonNull Functio * Note also that ignoring groups or subscribing later (i.e., on another thread) will result in * so-called group abandonment where a group will only contain one element and the group will be * re-created over and over as new upstream items trigger a new group. The behavior is - * a tradeoff between no-dataloss, upstream cancellation and excessive group creation. + * a trade-off between no-dataloss, upstream cancellation and excessive group creation. * *
*
Scheduler:
@@ -9529,7 +9529,7 @@ public final Observable> groupBy(@NonNull Functio * Note also that ignoring groups or subscribing later (i.e., on another thread) will result in * so-called group abandonment where a group will only contain one element and the group will be * re-created over and over as new upstream items trigger a new group. The behavior is - * a tradeoff between no-dataloss, upstream cancellation and excessive group creation. + * a trade-off between no-dataloss, upstream cancellation and excessive group creation. * *
*
Scheduler:
@@ -9564,7 +9564,7 @@ public final Observable> groupBy(@NonNull Functio Objects.requireNonNull(valueSelector, "valueSelector is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); - return RxJavaPlugins.onAssembly(new ObservableGroupBy(this, keySelector, valueSelector, bufferSize, delayError)); + return RxJavaPlugins.onAssembly(new ObservableGroupBy<>(this, keySelector, valueSelector, bufferSize, delayError)); } /** @@ -9611,7 +9611,7 @@ public final Observable groupJoin( Objects.requireNonNull(leftEnd, "leftEnd is null"); Objects.requireNonNull(rightEnd, "rightEnd is null"); Objects.requireNonNull(resultSelector, "resultSelector is null"); - return RxJavaPlugins.onAssembly(new ObservableGroupJoin( + return RxJavaPlugins.onAssembly(new ObservableGroupJoin<>( this, other, leftEnd, rightEnd, resultSelector)); } @@ -9939,7 +9939,7 @@ public final Single lastOrError() { @NonNull public final Observable lift(@NonNull ObservableOperator lifter) { Objects.requireNonNull(lifter, "lifter is null"); - return RxJavaPlugins.onAssembly(new ObservableLift(this, lifter)); + return RxJavaPlugins.onAssembly(new ObservableLift<>(this, lifter)); } /** @@ -9964,7 +9964,7 @@ public final Observable lift(@NonNull ObservableOperator Observable map(@NonNull Function mapper) { Objects.requireNonNull(mapper, "mapper is null"); - return RxJavaPlugins.onAssembly(new ObservableMap(this, mapper)); + return RxJavaPlugins.onAssembly(new ObservableMap<>(this, mapper)); } /** @@ -11584,7 +11584,7 @@ public final void safeSubscribe(@NonNull Observer observer) { if (observer instanceof SafeObserver) { subscribe(observer); } else { - subscribe(new SafeObserver(observer)); + subscribe(new SafeObserver<>(observer)); } } @@ -12352,7 +12352,7 @@ public final Observable skipWhile(@NonNull Predicate predicate) { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Observable sorted() { - return toList().toObservable().map(Functions.listSorter(Functions.naturalComparator())).flatMapIterable(Functions.>identity()); + return toList().toObservable().map(Functions.listSorter(Functions.naturalComparator())).flatMapIterable(Functions.identity()); } /** @@ -12377,7 +12377,7 @@ public final Observable sorted() { @NonNull public final Observable sorted(@NonNull Comparator sortFunction) { Objects.requireNonNull(sortFunction, "sortFunction is null"); - return toList().toObservable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.>identity()); + return toList().toObservable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.identity()); } /** @@ -14309,7 +14309,7 @@ public final Observable> timestamp(@NonNull TimeUnit unit) { public final Observable> timestamp(@NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return map(Functions.timestampWith(unit, scheduler)); + return map(Functions.timestampWith(unit, scheduler)); } /** @@ -14396,7 +14396,7 @@ public final R to(@NonNull ObservableConverter converter) { @NonNull public final Single<@NonNull List> toList(int capacityHint) { ObjectHelper.verifyPositive(capacityHint, "capacityHint"); - return RxJavaPlugins.onAssembly(new ObservableToListSingle>(this, capacityHint)); + return RxJavaPlugins.onAssembly(new ObservableToListSingle<>(this, capacityHint)); } /** @@ -14463,7 +14463,7 @@ public final R to(@NonNull ObservableConverter converter) { @NonNull public final Single<@NonNull Map> toMap(@NonNull Function keySelector) { Objects.requireNonNull(keySelector, "keySelector is null"); - return collect(HashMapSupplier.asSupplier(), Functions.toMapKeySelector(keySelector)); + return collect(HashMapSupplier.asSupplier(), Functions.toMapKeySelector(keySelector)); } /** @@ -14501,7 +14501,7 @@ public final Single> toMap( @NonNull Function valueSelector) { Objects.requireNonNull(keySelector, "keySelector is null"); Objects.requireNonNull(valueSelector, "valueSelector is null"); - return collect(HashMapSupplier.asSupplier(), Functions.toMapKeyValueSelector(keySelector, valueSelector)); + return collect(HashMapSupplier.asSupplier(), Functions.toMapKeyValueSelector(keySelector, valueSelector)); } /** @@ -14568,8 +14568,7 @@ public final Single> toMap( @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Single<@NonNull Map>> toMultimap(@NonNull Function keySelector) { - @SuppressWarnings({ "rawtypes", "unchecked" }) - Function valueSelector = (Function)Functions.identity(); + Function valueSelector = Functions.identity(); Supplier>> mapSupplier = HashMapSupplier.asSupplier(); Function> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); @@ -14684,7 +14683,7 @@ public final Single> toMap( @NonNull Function valueSelector, @NonNull Supplier>> mapSupplier ) { - return toMultimap(keySelector, valueSelector, mapSupplier, ArrayListSupplier.asFunction()); + return toMultimap(keySelector, valueSelector, mapSupplier, ArrayListSupplier.asFunction()); } /** @@ -14864,7 +14863,7 @@ public final Flowable toFlowable(@NonNull BackpressureStrategy strategy) { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Single<@NonNull List> toSortedList(int capacityHint) { - return toSortedList(Functions.naturalOrder(), capacityHint); + return toSortedList(Functions.naturalOrder(), capacityHint); } /** @@ -14992,7 +14991,7 @@ public final Observable> window(long count, long skip, int bufferS * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} operates by default on the {@code computation} {@link Scheduler}.
@@ -15026,7 +15025,7 @@ public final Observable> window(long timespan, long timeskip, @Non * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
You specify which {@link Scheduler} this operator will use.
@@ -15062,7 +15061,7 @@ public final Observable> window(long timespan, long timeskip, @Non * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
You specify which {@link Scheduler} this operator will use.
@@ -15104,7 +15103,7 @@ public final Observable> window(long timespan, long timeskip, @Non * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} operates by default on the {@code computation} {@link Scheduler}.
@@ -15138,7 +15137,7 @@ public final Observable> window(long timespan, @NonNull TimeUnit u * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} operates by default on the {@code computation} {@link Scheduler}.
@@ -15176,7 +15175,7 @@ public final Observable> window(long timespan, @NonNull TimeUnit u * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} operates by default on the {@code computation} {@link Scheduler}.
@@ -15215,7 +15214,7 @@ public final Observable> window(long timespan, @NonNull TimeUnit u * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
You specify which {@link Scheduler} this operator will use.
@@ -15252,7 +15251,7 @@ public final Observable> window(long timespan, @NonNull TimeUnit u * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
You specify which {@link Scheduler} this operator will use.
@@ -15292,7 +15291,7 @@ public final Observable> window(long timespan, @NonNull TimeUnit u * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
You specify which {@link Scheduler} this operator will use.
@@ -15334,7 +15333,7 @@ public final Observable> window(long timespan, @NonNull TimeUnit u * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
You specify which {@link Scheduler} this operator will use.
@@ -15381,7 +15380,7 @@ public final Observable> window( * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
@@ -15413,7 +15412,7 @@ public final Observable> window(@NonNull ObservableSource b * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
@@ -15450,7 +15449,7 @@ public final Observable> window(@NonNull ObservableSource b * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
@@ -15487,7 +15486,7 @@ public final Observable> window( * Note that ignoring windows or subscribing later (i.e., on another thread) will result in * so-called window abandonment where a window may not contain any elements. In this case, subsequent * elements will be dropped until the condition for the next window boundary is satisfied. The behavior is - * a tradeoff for ensuring upstream cancellation can happen under some race conditions. + * a trade-off for ensuring upstream cancellation can happen under some race conditions. *
*
Scheduler:
*
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
@@ -15766,7 +15765,7 @@ public final Observable withLatestFrom(@NonNull Iterable Observable zipWith(@NonNull Iterable other, @NonNull BiFunction zipper) { Objects.requireNonNull(other, "other is null"); Objects.requireNonNull(zipper, "zipper is null"); - return RxJavaPlugins.onAssembly(new ObservableZipIterable(this, other, zipper)); + return RxJavaPlugins.onAssembly(new ObservableZipIterable<>(this, other, zipper)); } /** @@ -16127,7 +16126,7 @@ public final TestObserver test(boolean dispose) { // NoPMD * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}. *

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).firstStage(Optional.empty());
@@ -16161,7 +16160,7 @@ public final CompletionStage firstStage(@Nullable T defaultItem) {
      * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and
      * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}.
      * 

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).singleStage(Optional.empty());
@@ -16194,7 +16193,7 @@ public final CompletionStage singleStage(@Nullable T defaultItem) {
      * The upstream will be also cancelled if the resulting {@code CompletionStage} is converted to and
      * completed manually by {@link CompletableFuture#complete(Object)} or {@link CompletableFuture#completeExceptionally(Throwable)}.
      * 

- * {@code CompletionStage}s don't have a notion of emptyness and allow {@code null}s, therefore, one can either use + * {@code CompletionStage}s don't have a notion of emptiness and allow {@code null}s, therefore, one can either use * a {@code defaultItem} of {@code null} or turn the flow into a sequence of {@link Optional}s and default to {@link Optional#empty()}: *


      * CompletionStage<Optional<T>> stage = source.map(Optional::of).lastStage(Optional.empty());
@@ -16356,7 +16355,7 @@ public final Stream blockingStream() {
     public final Stream blockingStream(int capacityHint) {
         Iterator iterator = blockingIterable(capacityHint).iterator();
         return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false)
-                .onClose(() -> ((Disposable)iterator).dispose());
+                .onClose(((Disposable) iterator)::dispose);
     }
 
     /**
diff --git a/src/main/java/io/reactivex/rxjava3/core/Single.java b/src/main/java/io/reactivex/rxjava3/core/Single.java
index 8bd0f1db4e..f0022aef17 100644
--- a/src/main/java/io/reactivex/rxjava3/core/Single.java
+++ b/src/main/java/io/reactivex/rxjava3/core/Single.java
@@ -158,7 +158,7 @@ public static  Single amb(@NonNull Iterable Single ambArray(@NonNull SingleSource... sources) {
         if (sources.length == 0) {
-            return error(SingleInternalHelper.emptyThrower());
+            return error(SingleInternalHelper.emptyThrower());
         }
         if (sources.length == 1) {
             @SuppressWarnings("unchecked")
@@ -423,7 +423,7 @@ public static  Flowable concatArray(@NonNull SingleSource...
     @SchedulerSupport(SchedulerSupport.NONE)
     @SafeVarargs
     public static  Flowable concatArrayEager(@NonNull SingleSource... sources) {
-        return Flowable.fromArray(sources).concatMapEager(SingleInternalHelper.toFlowable());
+        return Flowable.fromArray(sources).concatMapEager(SingleInternalHelper.toFlowable());
     }
 
     /**
@@ -451,7 +451,7 @@ public static  Flowable concatArrayEager(@NonNull SingleSource Flowable concatEager(@NonNull Publisher> sources) {
-        return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.toFlowable());
+        return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.toFlowable());
     }
 
     /**
@@ -477,7 +477,7 @@ public static  Flowable concatEager(@NonNull Publisher Flowable concatEager(@NonNull Iterable> sources) {
-        return Flowable.fromIterable(sources).concatMapEager(SingleInternalHelper.toFlowable());
+        return Flowable.fromIterable(sources).concatMapEager(SingleInternalHelper.toFlowable());
     }
 
     /**
@@ -570,7 +570,7 @@ public static  Single defer(@NonNull Supplier Single error(@NonNull Supplier errorSupplier) {
         Objects.requireNonNull(errorSupplier, "errorSupplier is null");
-        return RxJavaPlugins.onAssembly(new SingleError(errorSupplier));
+        return RxJavaPlugins.onAssembly(new SingleError<>(errorSupplier));
     }
 
     /**
@@ -632,7 +632,7 @@ public static  Single error(@NonNull Throwable exception) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static <@NonNull T> Single fromCallable(@NonNull Callable callable) {
         Objects.requireNonNull(callable, "callable is null");
-        return RxJavaPlugins.onAssembly(new SingleFromCallable(callable));
+        return RxJavaPlugins.onAssembly(new SingleFromCallable<>(callable));
     }
 
     /**
@@ -662,7 +662,7 @@ public static  Single error(@NonNull Throwable exception) {
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public static <@NonNull T> Single fromFuture(@NonNull Future future) {
-        return toSingle(Flowable.fromFuture(future));
+        return toSingle(Flowable.fromFuture(future));
     }
 
     /**
@@ -696,7 +696,7 @@ public static  Single error(@NonNull Throwable exception) {
     @SchedulerSupport(SchedulerSupport.NONE)
     @NonNull
     public static <@NonNull T> Single fromFuture(@NonNull Future future, long timeout, @NonNull TimeUnit unit) {
-        return toSingle(Flowable.fromFuture(future, timeout, unit));
+        return toSingle(Flowable.fromFuture(future, timeout, unit));
     }
 
     /**
@@ -732,7 +732,7 @@ public static  Single error(@NonNull Throwable exception) {
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public static <@NonNull T> Single fromFuture(@NonNull Future future, long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
-        return toSingle(Flowable.fromFuture(future, timeout, unit, scheduler));
+        return toSingle(Flowable.fromFuture(future, timeout, unit, scheduler));
     }
 
     /**
@@ -763,7 +763,7 @@ public static  Single error(@NonNull Throwable exception) {
     @SchedulerSupport(SchedulerSupport.CUSTOM)
     @NonNull
     public static <@NonNull T> Single fromFuture(@NonNull Future future, @NonNull Scheduler scheduler) {
-        return toSingle(Flowable.fromFuture(future, scheduler));
+        return toSingle(Flowable.fromFuture(future, scheduler));
     }
 
     /**
@@ -801,7 +801,7 @@ public static  Single error(@NonNull Throwable exception) {
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Single fromPublisher(@NonNull Publisher publisher) {
         Objects.requireNonNull(publisher, "publisher is null");
-        return RxJavaPlugins.onAssembly(new SingleFromPublisher(publisher));
+        return RxJavaPlugins.onAssembly(new SingleFromPublisher<>(publisher));
     }
 
     /**
@@ -825,11 +825,11 @@ public static  Single fromPublisher(@NonNull Publisher publis
     @SchedulerSupport(SchedulerSupport.NONE)
     public static  Single fromObservable(@NonNull ObservableSource observableSource) {
         Objects.requireNonNull(observableSource, "observableSource is null");
-        return RxJavaPlugins.onAssembly(new ObservableSingleSingle(observableSource, null));
+        return RxJavaPlugins.onAssembly(new ObservableSingleSingle<>(observableSource, null));
     }
 
     /**
-     * Returns a {@link Single} that invokes passed supplierfunction and emits its result
+     * Returns a {@link Single} that invokes passed supplier and emits its result
      * for each new SingleObserver that subscribes.
      * 

* Allows you to defer execution of passed function until SingleObserver subscribes to the {@link Single}. @@ -863,7 +863,7 @@ public static Single fromObservable(@NonNull ObservableSource Single fromSupplier(@NonNull Supplier supplier) { Objects.requireNonNull(supplier, "supplier is null"); - return RxJavaPlugins.onAssembly(new SingleFromSupplier(supplier)); + return RxJavaPlugins.onAssembly(new SingleFromSupplier<>(supplier)); } /** @@ -996,10 +996,9 @@ public static Flowable merge(@NonNull Publisher Single merge(@NonNull SingleSource> source) { Objects.requireNonNull(source, "source is null"); - return RxJavaPlugins.onAssembly(new SingleFlatMap, T>(source, (Function)Functions.identity())); + return RxJavaPlugins.onAssembly(new SingleFlatMap, T>(source, Functions.identity())); } /** @@ -1580,7 +1579,7 @@ public static Single wrap(@NonNull SingleSource source) { public static Single zip(@NonNull Iterable> sources, @NonNull Function zipper) { Objects.requireNonNull(zipper, "zipper is null"); Objects.requireNonNull(sources, "sources is null"); - return RxJavaPlugins.onAssembly(new SingleZipIterable(sources, zipper)); + return RxJavaPlugins.onAssembly(new SingleZipIterable<>(sources, zipper)); } /** @@ -2037,7 +2036,7 @@ public static Single zipArray(@NonNull Function(sources, zipper)); + return RxJavaPlugins.onAssembly(new SingleZipArray<>(sources, zipper)); } /** @@ -3057,7 +3056,7 @@ public final T blockingGet() { @SchedulerSupport(SchedulerSupport.NONE) public final Single lift(@NonNull SingleOperator lift) { Objects.requireNonNull(lift, "lift is null"); - return RxJavaPlugins.onAssembly(new SingleLift(this, lift)); + return RxJavaPlugins.onAssembly(new SingleLift<>(this, lift)); } /** @@ -3081,7 +3080,7 @@ public final Single lift(@NonNull SingleOperator @SchedulerSupport(SchedulerSupport.NONE) public final <@NonNull R> Single map(@NonNull Function mapper) { Objects.requireNonNull(mapper, "mapper is null"); - return RxJavaPlugins.onAssembly(new SingleMap(this, mapper)); + return RxJavaPlugins.onAssembly(new SingleMap<>(this, mapper)); } /** @@ -4068,7 +4067,7 @@ public final Flowable toFlowable() { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Future toFuture() { - return subscribeWith(new FutureSingleObserver()); + return subscribeWith(new FutureSingleObserver<>()); } /** @@ -4271,7 +4270,7 @@ private static Single toSingle(@NonNull Flowable source) { *

{@code mapOptional} does not operate by default on a particular {@link Scheduler}.
*
* @param the non-null output type - * @param mapper the function that receives the upstream success iteem and should return a non-empty {@code Optional} + * @param mapper the function that receives the upstream success item and should return a non-empty {@code Optional} * to emit as the success output or an empty {@code Optional} to complete the {@code Maybe} * @return the new Maybe instance * @since 3.0.0 diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java b/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java index 85b06bd313..d7a3457fe4 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java @@ -63,7 +63,6 @@ public CompositeException(@NonNull Throwable... exceptions) { */ public CompositeException(@NonNull Iterable errors) { Set deDupedExceptions = new LinkedHashSet<>(); - List localExceptions = new ArrayList<>(); if (errors != null) { for (Throwable ex : errors) { if (ex instanceof CompositeException) { @@ -81,7 +80,7 @@ public CompositeException(@NonNull Iterable errors) { if (deDupedExceptions.isEmpty()) { throw new IllegalArgumentException("errors is empty"); } - localExceptions.addAll(deDupedExceptions); + List localExceptions = new ArrayList<>(deDupedExceptions); this.exceptions = Collections.unmodifiableList(localExceptions); this.message = exceptions.size() + " exceptions occurred. "; } diff --git a/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java b/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java index 34557ce302..05ebb5bfb3 100644 --- a/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java +++ b/src/main/java/io/reactivex/rxjava3/exceptions/package-info.java @@ -17,7 +17,7 @@ /** * Exception handling utilities ({@link io.reactivex.rxjava3.exceptions.Exceptions Exceptions}), * composite exception container ({@link io.reactivex.rxjava3.exceptions.CompositeException CompositeException}) and - * various lifecycle-reladed ({@link io.reactivex.rxjava3.exceptions.MissingBackpressureException UndeliverableException}) + * various lifecycle-related ({@link io.reactivex.rxjava3.exceptions.MissingBackpressureException UndeliverableException}) * and behavior-violation exception types ({@link io.reactivex.rxjava3.exceptions.OnErrorNotImplementedException OnErrorNotImplementedException}, * {@link io.reactivex.rxjava3.exceptions.MissingBackpressureException MissingBackpressureException}). */ diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java index d08ce8d14a..51acc86c75 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposable.java @@ -95,7 +95,7 @@ public boolean offer(Object v1, Object v2) { @Nullable @Override - public Object poll() throws Exception { + public Object poll() { return null; // always empty } diff --git a/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java index 90928b64c6..8a6d4dd992 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposable.java @@ -32,7 +32,7 @@ public ListCompositeDisposable() { public ListCompositeDisposable(Disposable... resources) { Objects.requireNonNull(resources, "resources is null"); - this.resources = new LinkedList(); + this.resources = new LinkedList<>(); for (Disposable d : resources) { Objects.requireNonNull(d, "Disposable item is null"); this.resources.add(d); @@ -41,7 +41,7 @@ public ListCompositeDisposable(Disposable... resources) { public ListCompositeDisposable(Iterable resources) { Objects.requireNonNull(resources, "resources is null"); - this.resources = new LinkedList(); + this.resources = new LinkedList<>(); for (Disposable d : resources) { Objects.requireNonNull(d, "Disposable item is null"); this.resources.add(d); @@ -79,7 +79,7 @@ public boolean add(Disposable d) { if (!disposed) { List set = resources; if (set == null) { - set = new LinkedList(); + set = new LinkedList<>(); resources = set; } set.add(d); @@ -98,7 +98,7 @@ public boolean addAll(Disposable... ds) { if (!disposed) { List set = resources; if (set == null) { - set = new LinkedList(); + set = new LinkedList<>(); resources = set; } for (Disposable d : ds) { @@ -171,7 +171,7 @@ void dispose(List set) { } catch (Throwable ex) { Exceptions.throwIfFatal(ex); if (errors == null) { - errors = new ArrayList(); + errors = new ArrayList<>(); } errors.add(ex); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java b/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java index 05d1997893..1fee43d07e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java +++ b/src/main/java/io/reactivex/rxjava3/internal/functions/Functions.java @@ -36,46 +36,46 @@ private Functions() { @NonNull public static Function toFunction(@NonNull BiFunction f) { - return new Array2Func(f); + return new Array2Func<>(f); } @NonNull public static Function toFunction(@NonNull Function3 f) { - return new Array3Func(f); + return new Array3Func<>(f); } @NonNull public static Function toFunction(@NonNull Function4 f) { - return new Array4Func(f); + return new Array4Func<>(f); } @NonNull public static Function toFunction(@NonNull Function5 f) { - return new Array5Func(f); + return new Array5Func<>(f); } @NonNull public static Function toFunction( @NonNull Function6 f) { - return new Array6Func(f); + return new Array6Func<>(f); } @NonNull public static Function toFunction( @NonNull Function7 f) { - return new Array7Func(f); + return new Array7Func<>(f); } @NonNull public static Function toFunction( @NonNull Function8 f) { - return new Array8Func(f); + return new Array8Func<>(f); } @NonNull public static Function toFunction( @NonNull Function9 f) { - return new Array9Func(f); + return new Array9Func<>(f); } /** A singleton identity function. */ @@ -186,17 +186,17 @@ static final class JustValue implements Callable, Supplier, Function } @Override - public U call() throws Exception { + public U call() { return value; } @Override - public U apply(T t) throws Exception { + public U apply(T t) { return value; } @Override - public U get() throws Throwable { + public U get() { return value; } } @@ -209,7 +209,7 @@ public U get() throws Throwable { */ @NonNull public static Callable justCallable(@NonNull T value) { - return new JustValue(value); + return new JustValue<>(value); } /** @@ -220,7 +220,7 @@ public static Callable justCallable(@NonNull T value) { */ @NonNull public static Supplier justSupplier(@NonNull T value) { - return new JustValue(value); + return new JustValue<>(value); } /** @@ -232,7 +232,7 @@ public static Supplier justSupplier(@NonNull T value) { */ @NonNull public static Function justFunction(@NonNull U value) { - return new JustValue(value); + return new JustValue<>(value); } static final class CastToClass implements Function { @@ -243,7 +243,7 @@ static final class CastToClass implements Function { } @Override - public U apply(T t) throws Exception { + public U apply(T t) { return clazz.cast(t); } } @@ -257,7 +257,7 @@ public U apply(T t) throws Exception { */ @NonNull public static Function castFunction(@NonNull Class target) { - return new CastToClass(target); + return new CastToClass<>(target); } static final class ArrayListCapacityCallable implements Supplier> { @@ -268,13 +268,13 @@ static final class ArrayListCapacityCallable implements Supplier> { } @Override - public List get() throws Exception { - return new ArrayList(capacity); + public List get() { + return new ArrayList<>(capacity); } } public static Supplier> createArrayList(int capacity) { - return new ArrayListCapacityCallable(capacity); + return new ArrayListCapacityCallable<>(capacity); } static final class EqualsPredicate implements Predicate { @@ -285,25 +285,25 @@ static final class EqualsPredicate implements Predicate { } @Override - public boolean test(T t) throws Exception { + public boolean test(T t) { return Objects.equals(t, value); } } public static Predicate equalsWith(T value) { - return new EqualsPredicate(value); + return new EqualsPredicate<>(value); } enum HashSetCallable implements Supplier>, Callable> { INSTANCE; @Override - public Set call() throws Exception { - return new HashSet(); + public Set call() { + return new HashSet<>(); } @Override - public Set get() throws Throwable { - return new HashSet(); + public Set get() { + return new HashSet<>(); } } @@ -334,7 +334,7 @@ static final class NotificationOnError implements Consumer { @Override public void accept(Throwable v) throws Throwable { - onNotification.accept(Notification.createOnError(v)); + onNotification.accept(Notification.createOnError(v)); } } @@ -347,20 +347,20 @@ static final class NotificationOnComplete implements Action { @Override public void run() throws Throwable { - onNotification.accept(Notification.createOnComplete()); + onNotification.accept(Notification.createOnComplete()); } } public static Consumer notificationOnNext(Consumer> onNotification) { - return new NotificationOnNext(onNotification); + return new NotificationOnNext<>(onNotification); } public static Consumer notificationOnError(Consumer> onNotification) { - return new NotificationOnError(onNotification); + return new NotificationOnError<>(onNotification); } public static Action notificationOnComplete(Consumer> onNotification) { - return new NotificationOnComplete(onNotification); + return new NotificationOnComplete<>(onNotification); } static final class ActionConsumer implements Consumer { @@ -377,7 +377,7 @@ public void accept(T t) throws Throwable { } public static Consumer actionConsumer(Action action) { - return new ActionConsumer(action); + return new ActionConsumer<>(action); } static final class ClassFilter implements Predicate { @@ -388,13 +388,13 @@ static final class ClassFilter implements Predicate { } @Override - public boolean test(T t) throws Exception { + public boolean test(T t) { return clazz.isInstance(t); } } public static Predicate isInstanceOf(Class clazz) { - return new ClassFilter(clazz); + return new ClassFilter<>(clazz); } static final class BooleanSupplierPredicateReverse implements Predicate { @@ -411,7 +411,7 @@ public boolean test(T t) throws Throwable { } public static Predicate predicateReverseFor(BooleanSupplier supplier) { - return new BooleanSupplierPredicateReverse(supplier); + return new BooleanSupplierPredicateReverse<>(supplier); } static final class TimestampFunction implements Function> { @@ -425,13 +425,13 @@ static final class TimestampFunction implements Function> { } @Override - public Timed apply(T t) throws Exception { - return new Timed(t, scheduler.now(unit), unit); + public Timed apply(T t) { + return new Timed<>(t, scheduler.now(unit), unit); } } public static Function> timestampWith(TimeUnit unit, Scheduler scheduler) { - return new TimestampFunction(unit, scheduler); + return new TimestampFunction<>(unit, scheduler); } static final class ToMapKeySelector implements BiConsumer, T> { @@ -449,7 +449,7 @@ public void accept(Map m, T t) throws Throwable { } public static BiConsumer, T> toMapKeySelector(final Function keySelector) { - return new ToMapKeySelector(keySelector); + return new ToMapKeySelector<>(keySelector); } static final class ToMapKeyValueSelector implements BiConsumer, T> { @@ -471,7 +471,7 @@ public void accept(Map m, T t) throws Throwable { } public static BiConsumer, T> toMapKeyValueSelector(final Function keySelector, final Function valueSelector) { - return new ToMapKeyValueSelector(valueSelector, keySelector); + return new ToMapKeyValueSelector<>(valueSelector, keySelector); } static final class ToMultimapKeyValueSelector implements BiConsumer>, T> { @@ -506,7 +506,7 @@ public void accept(Map> m, T t) throws Throwable { public static BiConsumer>, T> toMultimapKeyValueSelector( final Function keySelector, final Function valueSelector, final Function> collectionFactory) { - return new ToMultimapKeyValueSelector(collectionFactory, valueSelector, keySelector); + return new ToMultimapKeyValueSelector<>(collectionFactory, valueSelector, keySelector); } enum NaturalComparator implements Comparator { @@ -539,7 +539,7 @@ public List apply(List v) { } public static Function, List> listSorter(final Comparator comparator) { - return new ListSorter(comparator); + return new ListSorter<>(comparator); } public static final Consumer REQUEST_MAX = new MaxRequestSubscription(); @@ -762,7 +762,7 @@ public Object call() { } @Override - public Object get() throws Throwable { + public Object get() { return null; } } @@ -777,7 +777,7 @@ public int compare(Object a, Object b) { static final class MaxRequestSubscription implements Consumer { @Override - public void accept(Subscription t) throws Exception { + public void accept(Subscription t) { t.request(Long.MAX_VALUE); } } @@ -796,7 +796,7 @@ public static class BoundedConsumer implements Consumer { } @Override - public void accept(Subscription s) throws Exception { + public void accept(Subscription s) { s.request(bufferSize); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java index 968e581625..210d920aad 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ObservableFlatMapStream.java @@ -112,7 +112,7 @@ public void onNext(@NonNull T t) { done = true; break; } - R value = Objects.requireNonNull(it.next(), "The Stream's Iterator.next retuned a null value"); + R value = Objects.requireNonNull(it.next(), "The Stream's Iterator.next returned a null value"); if (disposed) { done = true; break; diff --git a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java index e94f50cb67..c8802de3f6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelCollector.java @@ -209,7 +209,6 @@ public void onNext(T t) { Exceptions.throwIfFatal(ex); get().cancel(); onError(ex); - return; } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java b/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java index 8db129efb6..57d5f8c5c7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/DeferredScalarDisposable.java @@ -114,7 +114,7 @@ public final void complete() { @Nullable @Override - public final T poll() throws Exception { + public final T poll() { if (get() == FUSED_READY) { T v = value; value = null; diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java index f3d067f7ca..515e23e6bf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureObserver.java @@ -19,6 +19,7 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; +import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; @@ -41,7 +42,7 @@ public final class FutureObserver extends CountDownLatch public FutureObserver() { super(1); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override @@ -90,7 +91,7 @@ public T get() throws InterruptedException, ExecutionException { } @Override - public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + public T get(long timeout, @NonNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserver.java b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserver.java index 80abb70419..3e55963bea 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/observers/FutureSingleObserver.java @@ -18,6 +18,7 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; +import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.core.SingleObserver; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; @@ -40,7 +41,7 @@ public final class FutureSingleObserver extends CountDownLatch public FutureSingleObserver() { super(1); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override @@ -89,7 +90,7 @@ public T get() throws InterruptedException, ExecutionException { } @Override - public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + public T get(long timeout, @NonNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java index 253e518dad..da002c0dd6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCache.java @@ -39,7 +39,7 @@ public final class CompletableCache extends Completable implements CompletableOb public CompletableCache(CompletableSource source) { this.source = source; - this.observers = new AtomicReference(EMPTY); + this.observers = new AtomicReference<>(EMPTY); this.once = new AtomicBoolean(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java index 9d55b626ea..c16b847c58 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcat.java @@ -106,9 +106,9 @@ public void onSubscribe(Subscription s) { } if (prefetch == Integer.MAX_VALUE) { - queue = new SpscLinkedArrayQueue(Flowable.bufferSize()); + queue = new SpscLinkedArrayQueue<>(Flowable.bufferSize()); } else { - queue = new SpscArrayQueue(prefetch); + queue = new SpscArrayQueue<>(prefetch); } downstream.onSubscribe(this); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java index d368a04244..d91133e502 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromObservable.java @@ -26,7 +26,7 @@ public CompletableFromObservable(ObservableSource observable) { @Override protected void subscribeActual(final CompletableObserver observer) { - observable.subscribe(new CompletableFromObservableObserver(observer)); + observable.subscribe(new CompletableFromObservableObserver<>(observer)); } static final class CompletableFromObservableObserver implements Observer { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java index 0e65777e3f..6baeb7a87e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromPublisher.java @@ -29,7 +29,7 @@ public CompletableFromPublisher(Publisher flowable) { @Override protected void subscribeActual(final CompletableObserver downstream) { - flowable.subscribe(new FromPublisherSubscriber(downstream)); + flowable.subscribe(new FromPublisherSubscriber<>(downstream)); } static final class FromPublisherSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java index adee6c86f0..b035f142d9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableFromSingle.java @@ -26,7 +26,7 @@ public CompletableFromSingle(SingleSource single) { @Override protected void subscribeActual(final CompletableObserver observer) { - single.subscribe(new CompletableFromSingleObserver(observer)); + single.subscribe(new CompletableFromSingleObserver<>(observer)); } static final class CompletableFromSingleObserver implements SingleObserver { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java index 129084898a..15dd320cad 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableMaterialize.java @@ -34,6 +34,6 @@ public CompletableMaterialize(Completable source) { @Override protected void subscribeActual(SingleObserver> observer) { - source.subscribe(new MaterializeSingleObserver(observer)); + source.subscribe(new MaterializeSingleObserver<>(observer)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java index ccbafd06b5..9ad0d0a8d8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToFlowable.java @@ -28,7 +28,7 @@ public CompletableToFlowable(CompletableSource source) { @Override protected void subscribeActual(Subscriber s) { - SubscriberCompletableObserver os = new SubscriberCompletableObserver(s); + SubscriberCompletableObserver os = new SubscriberCompletableObserver<>(s); source.subscribe(os); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java index 91ce597c3b..095a975dbf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableToObservable.java @@ -71,7 +71,7 @@ public int requestFusion(int mode) { } @Override - public Void poll() throws Exception { + public Void poll() { return null; // always empty } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java index 7a4e99b332..3476a65b25 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/completable/CompletableUsing.java @@ -80,7 +80,7 @@ protected void subscribeActual(CompletableObserver observer) { return; } - source.subscribe(new UsingObserver(observer, resource, disposer, eager)); + source.subscribe(new UsingObserver<>(observer, resource, disposer, eager)); } static final class UsingObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java index 151541f63f..51015ce918 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableIterable.java @@ -38,7 +38,7 @@ public BlockingFlowableIterable(Flowable source, int bufferSize) { @Override public Iterator iterator() { - BlockingFlowableIterator it = new BlockingFlowableIterator(bufferSize); + BlockingFlowableIterator it = new BlockingFlowableIterator<>(bufferSize); source.subscribe(it); return it; } @@ -65,7 +65,7 @@ static final class BlockingFlowableIterator volatile Throwable error; BlockingFlowableIterator(int batchSize) { - this.queue = new SpscArrayQueue(batchSize); + this.queue = new SpscArrayQueue<>(batchSize); this.batchSize = batchSize; this.limit = batchSize - (batchSize >> 2); this.lock = new ReentrantLock(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java index 91fce3e427..1cc469a1b9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableLatest.java @@ -39,7 +39,7 @@ public BlockingFlowableLatest(Publisher source) { @Override public Iterator iterator() { - LatestSubscriberIterator lio = new LatestSubscriberIterator(); + LatestSubscriberIterator lio = new LatestSubscriberIterator<>(); Flowable.fromPublisher(source).materialize().subscribe(lio); return lio; } @@ -48,7 +48,7 @@ public Iterator iterator() { static final class LatestSubscriberIterator extends DisposableSubscriber> implements Iterator { final Semaphore notify = new Semaphore(0); // observer's notification - final AtomicReference> value = new AtomicReference>(); + final AtomicReference> value = new AtomicReference<>(); // iterator's notification Notification iteratorNotification; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java index f8fae1d413..bfd206eea9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecent.java @@ -40,7 +40,7 @@ public BlockingFlowableMostRecent(Flowable source, T initialValue) { @Override public Iterator iterator() { - MostRecentSubscriber mostRecentSubscriber = new MostRecentSubscriber(initialValue); + MostRecentSubscriber mostRecentSubscriber = new MostRecentSubscriber<>(initialValue); source.subscribe(mostRecentSubscriber); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java index 4db920bb1f..57ca264f0c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNext.java @@ -41,8 +41,8 @@ public BlockingFlowableNext(Publisher source) { @Override public Iterator iterator() { - NextSubscriber nextSubscriber = new NextSubscriber(); - return new NextIterator(source, nextSubscriber); + NextSubscriber nextSubscriber = new NextSubscriber<>(); + return new NextIterator<>(source, nextSubscriber); } // test needs to access the observer.waiting flag @@ -133,7 +133,7 @@ public void remove() { } static final class NextSubscriber extends DisposableSubscriber> { - private final BlockingQueue> buf = new ArrayBlockingQueue>(1); + private final BlockingQueue> buf = new ArrayBlockingQueue<>(1); final AtomicInteger waiting = new AtomicInteger(); @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java index 0933703803..84ea50cbf7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAll.java @@ -31,7 +31,7 @@ public FlowableAll(Flowable source, Predicate predicate) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new AllSubscriber(s, predicate)); + source.subscribe(new AllSubscriber<>(s, predicate)); } static final class AllSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java index 516d37bf7c..8d1bf998ef 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllSingle.java @@ -35,12 +35,12 @@ public FlowableAllSingle(Flowable source, Predicate predicate) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new AllSubscriber(observer, predicate)); + source.subscribe(new AllSubscriber<>(observer, predicate)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableAll(source, predicate)); + return RxJavaPlugins.onAssembly(new FlowableAll<>(source, predicate)); } static final class AllSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java index 546beb0fae..ff650b5719 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmb.java @@ -69,7 +69,7 @@ public void subscribeActual(Subscriber s) { return; } - AmbCoordinator ac = new AmbCoordinator(s, count); + AmbCoordinator ac = new AmbCoordinator<>(s, count); ac.subscribe(sources); } @@ -89,7 +89,7 @@ public void subscribe(Publisher[] sources) { AmbInnerSubscriber[] as = subscribers; int len = as.length; for (int i = 0; i < len; i++) { - as[i] = new AmbInnerSubscriber(this, i + 1, downstream); + as[i] = new AmbInnerSubscriber<>(this, i + 1, downstream); } winner.lazySet(0); // release the contents of 'as' downstream.onSubscribe(this); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java index 401d444cca..d0adcb6dbe 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAny.java @@ -29,7 +29,7 @@ public FlowableAny(Flowable source, Predicate predicate) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new AnySubscriber(s, predicate)); + source.subscribe(new AnySubscriber<>(s, predicate)); } static final class AnySubscriber extends DeferredScalarSubscription implements FlowableSubscriber { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java index 6a9e4aacbb..7ca8a6b428 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnySingle.java @@ -34,12 +34,12 @@ public FlowableAnySingle(Flowable source, Predicate predicate) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new AnySubscriber(observer, predicate)); + source.subscribe(new AnySubscriber<>(observer, predicate)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableAny(source, predicate)); + return RxJavaPlugins.onAssembly(new FlowableAny<>(source, predicate)); } static final class AnySubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java index 14654d35ee..9caafbc8e5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingSubscribe.java @@ -42,9 +42,9 @@ private FlowableBlockingSubscribe() { * @param the value type */ public static void subscribe(Publisher o, Subscriber subscriber) { - final BlockingQueue queue = new LinkedBlockingQueue(); + final BlockingQueue queue = new LinkedBlockingQueue<>(); - BlockingSubscriber bs = new BlockingSubscriber(queue); + BlockingSubscriber bs = new BlockingSubscriber<>(queue); o.subscribe(bs); @@ -82,7 +82,7 @@ public static void subscribe(Publisher o, Subscriber */ public static void subscribe(Publisher o) { BlockingIgnoringReceiver callback = new BlockingIgnoringReceiver(); - LambdaSubscriber ls = new LambdaSubscriber(Functions.emptyConsumer(), + LambdaSubscriber ls = new LambdaSubscriber<>(Functions.emptyConsumer(), callback, callback, Functions.REQUEST_MAX); o.subscribe(ls); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java index 08f89e99e2..04f5ae182e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBuffer.java @@ -42,11 +42,11 @@ public FlowableBuffer(Flowable source, int size, int skip, Supplier buffer @Override public void subscribeActual(Subscriber s) { if (size == skip) { - source.subscribe(new PublisherBufferExactSubscriber(s, size, bufferSupplier)); + source.subscribe(new PublisherBufferExactSubscriber<>(s, size, bufferSupplier)); } else if (skip > size) { - source.subscribe(new PublisherBufferSkipSubscriber(s, size, skip, bufferSupplier)); + source.subscribe(new PublisherBufferSkipSubscriber<>(s, size, skip, bufferSupplier)); } else { - source.subscribe(new PublisherBufferOverlappingSubscriber(s, size, skip, bufferSupplier)); + source.subscribe(new PublisherBufferOverlappingSubscriber<>(s, size, skip, bufferSupplier)); } } @@ -318,7 +318,7 @@ static final class PublisherBufferOverlappingSubscriber(); + this.buffers = new ArrayDeque<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java index 47f6e6bf06..251144a1d2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferBoundary.java @@ -44,7 +44,7 @@ public FlowableBufferBoundary(Flowable source, Publisher buff @Override protected void subscribeActual(Subscriber s) { BufferBoundarySubscriber parent = - new BufferBoundarySubscriber( + new BufferBoundarySubscriber<>( s, bufferOpen, bufferClose, bufferSupplier ); s.onSubscribe(parent); @@ -93,11 +93,11 @@ static final class BufferBoundarySubscriber, this.bufferSupplier = bufferSupplier; this.bufferOpen = bufferOpen; this.bufferClose = bufferClose; - this.queue = new SpscLinkedArrayQueue(bufferSize()); + this.queue = new SpscLinkedArrayQueue<>(bufferSize()); this.subscribers = new CompositeDisposable(); this.requested = new AtomicLong(); - this.upstream = new AtomicReference(); - this.buffers = new LinkedHashMap(); + this.upstream = new AtomicReference<>(); + this.buffers = new LinkedHashMap<>(); this.errors = new AtomicThrowable(); } @@ -105,7 +105,7 @@ static final class BufferBoundarySubscriber, public void onSubscribe(Subscription s) { if (SubscriptionHelper.setOnce(this.upstream, s)) { - BufferOpenSubscriber open = new BufferOpenSubscriber(this); + BufferOpenSubscriber open = new BufferOpenSubscriber<>(this); subscribers.add(open); bufferOpen.subscribe(open); @@ -199,7 +199,7 @@ void open(Open token) { bufs.put(idx, buf); } - BufferCloseSubscriber bc = new BufferCloseSubscriber(this, idx); + BufferCloseSubscriber bc = new BufferCloseSubscriber<>(this, idx); subscribers.add(bc); p.subscribe(bc); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java index a1ca188b13..8d23e3c7bc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferExactBoundary.java @@ -41,7 +41,7 @@ public FlowableBufferExactBoundary(Flowable source, Publisher boundary, Su @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new BufferExactBoundarySubscriber(new SerializedSubscriber(s), bufferSupplier, boundary)); + source.subscribe(new BufferExactBoundarySubscriber<>(new SerializedSubscriber<>(s), bufferSupplier, boundary)); } static final class BufferExactBoundarySubscriber, B> @@ -58,7 +58,7 @@ static final class BufferExactBoundarySubscriber actual, Supplier bufferSupplier, Publisher boundary) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.boundary = boundary; } @@ -84,7 +84,7 @@ public void onSubscribe(Subscription s) { buffer = b; - BufferBoundarySubscriber bs = new BufferBoundarySubscriber(this); + BufferBoundarySubscriber bs = new BufferBoundarySubscriber<>(this); other = bs; downstream.onSubscribe(this); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java index 0b3faed1c5..854e0460ed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTimed.java @@ -56,16 +56,16 @@ public FlowableBufferTimed(Flowable source, long timespan, long timeskip, Tim @Override protected void subscribeActual(Subscriber s) { if (timespan == timeskip && maxSize == Integer.MAX_VALUE) { - source.subscribe(new BufferExactUnboundedSubscriber( - new SerializedSubscriber(s), + source.subscribe(new BufferExactUnboundedSubscriber<>( + new SerializedSubscriber<>(s), bufferSupplier, timespan, unit, scheduler)); return; } Scheduler.Worker w = scheduler.createWorker(); if (timespan == timeskip) { - source.subscribe(new BufferExactBoundedSubscriber( - new SerializedSubscriber(s), + source.subscribe(new BufferExactBoundedSubscriber<>( + new SerializedSubscriber<>(s), bufferSupplier, timespan, unit, maxSize, restartTimerOnMaxSize, w )); @@ -73,8 +73,8 @@ protected void subscribeActual(Subscriber s) { } // Can't use maxSize because what to do if a buffer is full but its // timespan hasn't been elapsed? - source.subscribe(new BufferSkipBoundedSubscriber( - new SerializedSubscriber(s), + source.subscribe(new BufferSkipBoundedSubscriber<>( + new SerializedSubscriber<>(s), bufferSupplier, timespan, timeskip, unit, w)); } @@ -89,12 +89,12 @@ static final class BufferExactUnboundedSubscriber timer = new AtomicReference(); + final AtomicReference timer = new AtomicReference<>(); BufferExactUnboundedSubscriber( Subscriber actual, Supplier bufferSupplier, long timespan, TimeUnit unit, Scheduler scheduler) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.timespan = timespan; this.unit = unit; @@ -238,13 +238,13 @@ static final class BufferSkipBoundedSubscriber actual, Supplier bufferSupplier, long timespan, long timeskip, TimeUnit unit, Worker w) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.timespan = timespan; this.timeskip = timeskip; this.unit = unit; this.w = w; - this.buffers = new LinkedList(); + this.buffers = new LinkedList<>(); } @Override @@ -298,7 +298,7 @@ public void onError(Throwable t) { public void onComplete() { List bs; synchronized (this) { - bs = new ArrayList(buffers); + bs = new ArrayList<>(buffers); buffers.clear(); } @@ -404,7 +404,7 @@ static final class BufferExactBoundedSubscriber bufferSupplier, long timespan, TimeUnit unit, int maxSize, boolean restartOnMaxSize, Worker w) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.timespan = timespan; this.unit = unit; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java index aea0b3150d..25d5fb71a3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCache.java @@ -99,15 +99,15 @@ public FlowableCache(Flowable source, int capacityHint) { super(source); this.capacityHint = capacityHint; this.once = new AtomicBoolean(); - Node n = new Node(capacityHint); + Node n = new Node<>(capacityHint); this.head = n; this.tail = n; - this.subscribers = new AtomicReference[]>(EMPTY); + this.subscribers = new AtomicReference<>(EMPTY); } @Override protected void subscribeActual(Subscriber t) { - CacheSubscription consumer = new CacheSubscription(t, this); + CacheSubscription consumer = new CacheSubscription<>(t, this); t.onSubscribe(consumer); add(consumer); @@ -303,7 +303,7 @@ public void onNext(T t) { int tailOffset = this.tailOffset; // if the current tail node is full, create a fresh node if (tailOffset == capacityHint) { - Node n = new Node(tailOffset); + Node n = new Node<>(tailOffset); n.values[0] = t; this.tailOffset = 1; tail.next = n; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java index c2560cf6e3..b8751a23f9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollect.java @@ -44,7 +44,7 @@ protected void subscribeActual(Subscriber s) { return; } - source.subscribe(new CollectSubscriber(s, u, collector)); + source.subscribe(new CollectSubscriber<>(s, u, collector)); } static final class CollectSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java index edf17d95ef..f159911fba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCollectSingle.java @@ -49,12 +49,12 @@ protected void subscribeActual(SingleObserver observer) { return; } - source.subscribe(new CollectSubscriber(observer, u, collector)); + source.subscribe(new CollectSubscriber<>(observer, u, collector)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableCollect(source, initialSupplier, collector)); + return RxJavaPlugins.onAssembly(new FlowableCollect<>(source, initialSupplier, collector)); } static final class CollectSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java index 24306072bc..392de62d22 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatest.java @@ -132,12 +132,12 @@ public void subscribeActual(Subscriber s) { return; } if (n == 1) { - ((Publisher)a[0]).subscribe(new MapSubscriber(s, new SingletonArrayFunc())); + a[0].subscribe(new MapSubscriber<>(s, new SingletonArrayFunc())); return; } CombineLatestCoordinator coordinator = - new CombineLatestCoordinator(s, combiner, n, bufferSize, delayErrors); + new CombineLatestCoordinator<>(s, combiner, n, bufferSize, delayErrors); s.onSubscribe(coordinator); @@ -183,13 +183,13 @@ static final class CombineLatestCoordinator @SuppressWarnings("unchecked") CombineLatestInnerSubscriber[] a = new CombineLatestInnerSubscriber[n]; for (int i = 0; i < n; i++) { - a[i] = new CombineLatestInnerSubscriber(this, i, bufferSize); + a[i] = new CombineLatestInnerSubscriber<>(this, i, bufferSize); } this.subscribers = a; this.latest = new Object[n]; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); this.requested = new AtomicLong(); - this.error = new AtomicReference(); + this.error = new AtomicReference<>(); this.delayErrors = delayErrors; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java index ad1651b261..81834bba61 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatArray.java @@ -34,7 +34,7 @@ public FlowableConcatArray(Publisher[] sources, boolean delayError) @Override protected void subscribeActual(Subscriber s) { - ConcatArraySubscriber parent = new ConcatArraySubscriber(sources, delayError, s); + ConcatArraySubscriber parent = new ConcatArraySubscriber<>(sources, delayError, s); s.onSubscribe(parent); parent.onComplete(); @@ -82,7 +82,7 @@ public void onError(Throwable t) { if (delayError) { List list = errors; if (list == null) { - list = new ArrayList(sources.length - index + 1); + list = new ArrayList<>(sources.length - index + 1); errors = list; } list.add(t); @@ -121,7 +121,7 @@ public void onComplete() { if (delayError) { List list = errors; if (list == null) { - list = new ArrayList(n - i + 1); + list = new ArrayList<>(n - i + 1); errors = list; } list.add(ex); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java index f757fb5f3b..98d8ea4410 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMap.java @@ -46,11 +46,11 @@ public static Subscriber subscribe(Subscriber s, Function(s, mapper, prefetch, false); + return new ConcatMapDelayed<>(s, mapper, prefetch, false); case END: - return new ConcatMapDelayed(s, mapper, prefetch, true); + return new ConcatMapDelayed<>(s, mapper, prefetch, true); default: - return new ConcatMapImmediate(s, mapper, prefetch); + return new ConcatMapImmediate<>(s, mapper, prefetch); } } @@ -100,7 +100,7 @@ abstract static class BaseConcatMapSubscriber this.mapper = mapper; this.prefetch = prefetch; this.limit = prefetch - (prefetch >> 2); - this.inner = new ConcatMapInner(this); + this.inner = new ConcatMapInner<>(this); this.errors = new AtomicThrowable(); } @@ -133,7 +133,7 @@ public final void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(prefetch); + queue = new SpscArrayQueue<>(prefetch); subscribeActual(); @@ -328,7 +328,7 @@ void drain() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription(vr, inner)); + inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); } } else { @@ -527,7 +527,7 @@ void drain() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription(vr, inner)); + inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); } } else { active = true; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java index 9aee3eaebb..ea39af45a2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEager.java @@ -51,7 +51,7 @@ public FlowableConcatMapEager(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ConcatMapEagerDelayErrorSubscriber( + source.subscribe(new ConcatMapEagerDelayErrorSubscriber<>( s, mapper, maxConcurrency, prefetch, errorMode)); } @@ -93,7 +93,7 @@ static final class ConcatMapEagerDelayErrorSubscriber this.maxConcurrency = maxConcurrency; this.prefetch = prefetch; this.errorMode = errorMode; - this.subscribers = new SpscLinkedArrayQueue>(Math.min(prefetch, maxConcurrency)); + this.subscribers = new SpscLinkedArrayQueue<>(Math.min(prefetch, maxConcurrency)); this.errors = new AtomicThrowable(); this.requested = new AtomicLong(); } @@ -123,7 +123,7 @@ public void onNext(T t) { return; } - InnerQueuedSubscriber inner = new InnerQueuedSubscriber(this, prefetch); + InnerQueuedSubscriber inner = new InnerQueuedSubscriber<>(this, prefetch); if (cancelled) { return; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java index 8b1e7ec68b..36d465d190 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerPublisher.java @@ -53,7 +53,7 @@ public FlowableConcatMapEagerPublisher(Publisher source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ConcatMapEagerDelayErrorSubscriber( + source.subscribe(new ConcatMapEagerDelayErrorSubscriber<>( s, mapper, maxConcurrency, prefetch, errorMode)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java index 05c984b533..d59677efa1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java @@ -50,13 +50,13 @@ public FlowableConcatMapScheduler(Flowable source, protected void subscribeActual(Subscriber s) { switch (errorMode) { case BOUNDARY: - source.subscribe(new ConcatMapDelayed(s, mapper, prefetch, false, scheduler.createWorker())); + source.subscribe(new ConcatMapDelayed<>(s, mapper, prefetch, false, scheduler.createWorker())); break; case END: - source.subscribe(new ConcatMapDelayed(s, mapper, prefetch, true, scheduler.createWorker())); + source.subscribe(new ConcatMapDelayed<>(s, mapper, prefetch, true, scheduler.createWorker())); break; default: - source.subscribe(new ConcatMapImmediate(s, mapper, prefetch, scheduler.createWorker())); + source.subscribe(new ConcatMapImmediate<>(s, mapper, prefetch, scheduler.createWorker())); } } @@ -98,7 +98,7 @@ abstract static class BaseConcatMapSubscriber this.mapper = mapper; this.prefetch = prefetch; this.limit = prefetch - (prefetch >> 2); - this.inner = new ConcatMapInner(this); + this.inner = new ConcatMapInner<>(this); this.errors = new AtomicThrowable(); this.worker = worker; } @@ -132,7 +132,7 @@ public final void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(prefetch); + queue = new SpscArrayQueue<>(prefetch); subscribeActual(); @@ -341,7 +341,7 @@ public void run() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription(vr, inner)); + inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); } } else { @@ -524,7 +524,7 @@ public void run() { continue; } else { active = true; - inner.setSubscription(new WeakScalarSubscription(vr, inner)); + inner.setSubscription(new WeakScalarSubscription<>(vr, inner)); } } else { active = true; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java index 16556a5892..31729e450f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletable.java @@ -40,7 +40,7 @@ public FlowableConcatWithCompletable(Flowable source, CompletableSource other @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ConcatWithSubscriber(s, other)); + source.subscribe(new ConcatWithSubscriber<>(s, other)); } static final class ConcatWithSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java index 92c65809c7..b7db7fd093 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybe.java @@ -41,7 +41,7 @@ public FlowableConcatWithMaybe(Flowable source, MaybeSource othe @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ConcatWithSubscriber(s, other)); + source.subscribe(new ConcatWithSubscriber<>(s, other)); } static final class ConcatWithSubscriber @@ -59,7 +59,7 @@ static final class ConcatWithSubscriber ConcatWithSubscriber(Subscriber actual, MaybeSource other) { super(actual); this.other = other; - this.otherDisposable = new AtomicReference(); + this.otherDisposable = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java index b1b65d9dbf..c93ee51ba8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingle.java @@ -41,7 +41,7 @@ public FlowableConcatWithSingle(Flowable source, SingleSource ot @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ConcatWithSubscriber(s, other)); + source.subscribe(new ConcatWithSubscriber<>(s, other)); } static final class ConcatWithSubscriber @@ -57,7 +57,7 @@ static final class ConcatWithSubscriber ConcatWithSubscriber(Subscriber actual, SingleSource other) { super(actual); this.other = other; - this.otherDisposable = new AtomicReference(); + this.otherDisposable = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java index 517d026e3f..928f36209c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCountSingle.java @@ -36,7 +36,7 @@ protected void subscribeActual(SingleObserver observer) { @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableCount(source)); + return RxJavaPlugins.onAssembly(new FlowableCount<>(source)); } static final class CountSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java index 66cbd7409b..b7091c31f9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreate.java @@ -45,23 +45,23 @@ public void subscribeActual(Subscriber t) { switch (backpressure) { case MISSING: { - emitter = new MissingEmitter(t); + emitter = new MissingEmitter<>(t); break; } case ERROR: { - emitter = new ErrorAsyncEmitter(t); + emitter = new ErrorAsyncEmitter<>(t); break; } case DROP: { - emitter = new DropAsyncEmitter(t); + emitter = new DropAsyncEmitter<>(t); break; } case LATEST: { - emitter = new LatestAsyncEmitter(t); + emitter = new LatestAsyncEmitter<>(t); break; } default: { - emitter = new BufferAsyncEmitter(t, bufferSize()); + emitter = new BufferAsyncEmitter<>(t, bufferSize()); break; } } @@ -97,7 +97,7 @@ static final class SerializedEmitter SerializedEmitter(BaseEmitter emitter) { this.emitter = emitter; this.errors = new AtomicThrowable(); - this.queue = new SpscLinkedArrayQueue(16); + this.queue = new SpscLinkedArrayQueue<>(16); } @Override @@ -347,7 +347,7 @@ public final long requested() { @Override public final FlowableEmitter serialize() { - return new SerializedEmitter(this); + return new SerializedEmitter<>(this); } @Override @@ -460,7 +460,7 @@ static final class BufferAsyncEmitter extends BaseEmitter { BufferAsyncEmitter(Subscriber actual, int capacityHint) { super(actual); - this.queue = new SpscLinkedArrayQueue(capacityHint); + this.queue = new SpscLinkedArrayQueue<>(capacityHint); this.wip = new AtomicInteger(); } @@ -598,7 +598,7 @@ static final class LatestAsyncEmitter extends BaseEmitter { LatestAsyncEmitter(Subscriber downstream) { super(downstream); - this.queue = new AtomicReference(); + this.queue = new AtomicReference<>(); this.wip = new AtomicInteger(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java index ab86164622..16c666b283 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounce.java @@ -38,7 +38,7 @@ public FlowableDebounce(Flowable source, Function s) { - source.subscribe(new DebounceSubscriber(new SerializedSubscriber(s), debounceSelector)); + source.subscribe(new DebounceSubscriber<>(new SerializedSubscriber<>(s), debounceSelector)); } static final class DebounceSubscriber extends AtomicLong @@ -50,7 +50,7 @@ static final class DebounceSubscriber extends AtomicLong Subscription upstream; - final AtomicReference debouncer = new AtomicReference(); + final AtomicReference debouncer = new AtomicReference<>(); volatile long index; @@ -96,7 +96,7 @@ public void onNext(T t) { return; } - DebounceInnerSubscriber dis = new DebounceInnerSubscriber(this, idx, t); + DebounceInnerSubscriber dis = new DebounceInnerSubscriber<>(this, idx, t); if (debouncer.compareAndSet(d, dis)) { p.subscribe(dis); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java index 582c04c6e5..82ae29d497 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTimed.java @@ -42,8 +42,8 @@ public FlowableDebounceTimed(Flowable source, long timeout, TimeUnit unit, Sc @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new DebounceTimedSubscriber( - new SerializedSubscriber(s), + source.subscribe(new DebounceTimedSubscriber<>( + new SerializedSubscriber<>(s), timeout, unit, scheduler.createWorker())); } @@ -93,7 +93,7 @@ public void onNext(T t) { d.dispose(); } - DebounceEmitter de = new DebounceEmitter(t, idx, this); + DebounceEmitter de = new DebounceEmitter<>(t, idx, this); timer = de; d = worker.schedule(de, timeout, unit); de.setResource(d); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java index 18950363e2..e66acd39e9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelay.java @@ -42,12 +42,12 @@ protected void subscribeActual(Subscriber t) { if (delayError) { downstream = t; } else { - downstream = new SerializedSubscriber(t); + downstream = new SerializedSubscriber<>(t); } Scheduler.Worker w = scheduler.createWorker(); - source.subscribe(new DelaySubscriber(downstream, delay, unit, w, delayError)); + source.subscribe(new DelaySubscriber<>(downstream, delay, unit, w, delayError)); } static final class DelaySubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java index 1ae7f8210e..c4e199c7e2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOther.java @@ -37,7 +37,7 @@ public FlowableDelaySubscriptionOther(Publisher main, Publisher @Override public void subscribeActual(final Subscriber child) { - MainSubscriber parent = new MainSubscriber(child, main); + MainSubscriber parent = new MainSubscriber<>(child, main); child.onSubscribe(parent); other.subscribe(parent.other); } @@ -58,7 +58,7 @@ static final class MainSubscriber extends AtomicLong implements FlowableSubsc this.downstream = downstream; this.main = main; this.other = new OtherSubscriber(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } void next() { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java index d5e46e6d23..dc2de8e389 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerialize.java @@ -34,7 +34,7 @@ public FlowableDematerialize(Flowable source, Function subscriber) { - source.subscribe(new DematerializeSubscriber(subscriber, selector)); + source.subscribe(new DematerializeSubscriber<>(subscriber, selector)); } static final class DematerializeSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java index e3f266094e..e03ee6094b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetach.java @@ -27,7 +27,7 @@ public FlowableDetach(Flowable source) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new DetachSubscriber(s)); + source.subscribe(new DetachSubscriber<>(s)); } static final class DetachSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java index 1cd4be2458..bc62429611 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinct.java @@ -52,7 +52,7 @@ protected void subscribeActual(Subscriber subscriber) { return; } - source.subscribe(new DistinctSubscriber(subscriber, keySelector, collection)); + source.subscribe(new DistinctSubscriber<>(subscriber, keySelector, collection)); } static final class DistinctSubscriber extends BasicFuseableSubscriber { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java index f3ee070429..6eb323625d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChanged.java @@ -37,9 +37,9 @@ public FlowableDistinctUntilChanged(Flowable source, Function k protected void subscribeActual(Subscriber s) { if (s instanceof ConditionalSubscriber) { ConditionalSubscriber cs = (ConditionalSubscriber) s; - source.subscribe(new DistinctUntilChangedConditionalSubscriber(cs, keySelector, comparer)); + source.subscribe(new DistinctUntilChangedConditionalSubscriber<>(cs, keySelector, comparer)); } else { - source.subscribe(new DistinctUntilChangedSubscriber(s, keySelector, comparer)); + source.subscribe(new DistinctUntilChangedSubscriber<>(s, keySelector, comparer)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java index ed5d969328..7aa451e1f6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNext.java @@ -39,9 +39,9 @@ public FlowableDoAfterNext(Flowable source, Consumer onAfterNext) @Override protected void subscribeActual(Subscriber s) { if (s instanceof ConditionalSubscriber) { - source.subscribe(new DoAfterConditionalSubscriber((ConditionalSubscriber)s, onAfterNext)); + source.subscribe(new DoAfterConditionalSubscriber<>((ConditionalSubscriber) s, onAfterNext)); } else { - source.subscribe(new DoAfterSubscriber(s, onAfterNext)); + source.subscribe(new DoAfterSubscriber<>(s, onAfterNext)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java index 8cc70f171c..9373819291 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinally.java @@ -41,9 +41,9 @@ public FlowableDoFinally(Flowable source, Action onFinally) { @Override protected void subscribeActual(Subscriber s) { if (s instanceof ConditionalSubscriber) { - source.subscribe(new DoFinallyConditionalSubscriber((ConditionalSubscriber)s, onFinally)); + source.subscribe(new DoFinallyConditionalSubscriber<>((ConditionalSubscriber) s, onFinally)); } else { - source.subscribe(new DoFinallySubscriber(s, onFinally)); + source.subscribe(new DoFinallySubscriber<>(s, onFinally)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java index 74d74f41cf..2e6d45d5e7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEach.java @@ -44,10 +44,10 @@ public FlowableDoOnEach(Flowable source, Consumer onNext, @Override protected void subscribeActual(Subscriber s) { if (s instanceof ConditionalSubscriber) { - source.subscribe(new DoOnEachConditionalSubscriber( - (ConditionalSubscriber)s, onNext, onError, onComplete, onAfterTerminate)); + source.subscribe(new DoOnEachConditionalSubscriber<>( + (ConditionalSubscriber) s, onNext, onError, onComplete, onAfterTerminate)); } else { - source.subscribe(new DoOnEachSubscriber( + source.subscribe(new DoOnEachSubscriber<>( s, onNext, onError, onComplete, onAfterTerminate)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java index 687474a403..a75881d2ba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnLifecycle.java @@ -35,7 +35,7 @@ public FlowableDoOnLifecycle(Flowable source, Consumer @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SubscriptionLambdaSubscriber(s, onSubscribe, onRequest, onCancel)); + source.subscribe(new SubscriptionLambdaSubscriber<>(s, onSubscribe, onRequest, onCancel)); } static final class SubscriptionLambdaSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java index 31c21e2552..91c9c0bee7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAt.java @@ -35,7 +35,7 @@ public FlowableElementAt(Flowable source, long index, T defaultValue, boolean @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ElementAtSubscriber(s, index, defaultValue, errorOnFewer)); + source.subscribe(new ElementAtSubscriber<>(s, index, defaultValue, errorOnFewer)); } static final class ElementAtSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java index 67f4744b76..fc30483fd2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtMaybe.java @@ -33,12 +33,12 @@ public FlowableElementAtMaybe(Flowable source, long index) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new ElementAtSubscriber(observer, index)); + source.subscribe(new ElementAtSubscriber<>(observer, index)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableElementAt(source, index, null, false)); + return RxJavaPlugins.onAssembly(new FlowableElementAt<>(source, index, null, false)); } static final class ElementAtSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java index 3260307745..b743b6a3b7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtSingle.java @@ -38,12 +38,12 @@ public FlowableElementAtSingle(Flowable source, long index, T defaultValue) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new ElementAtSubscriber(observer, index, defaultValue)); + source.subscribe(new ElementAtSubscriber<>(observer, index, defaultValue)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableElementAt(source, index, defaultValue, true)); + return RxJavaPlugins.onAssembly(new FlowableElementAt<>(source, index, defaultValue, true)); } static final class ElementAtSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java index 52aac8e1f4..790881a160 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilter.java @@ -31,10 +31,10 @@ public FlowableFilter(Flowable source, Predicate predicate) { @Override protected void subscribeActual(Subscriber s) { if (s instanceof ConditionalSubscriber) { - source.subscribe(new FilterConditionalSubscriber( - (ConditionalSubscriber)s, predicate)); + source.subscribe(new FilterConditionalSubscriber<>( + (ConditionalSubscriber) s, predicate)); } else { - source.subscribe(new FilterSubscriber(s, predicate)); + source.subscribe(new FilterSubscriber<>(s, predicate)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java index 1c14ea54af..ea6a4f76ed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMap.java @@ -55,7 +55,7 @@ protected void subscribeActual(Subscriber s) { public static FlowableSubscriber subscribe(Subscriber s, Function> mapper, boolean delayErrors, int maxConcurrency, int bufferSize) { - return new MergeSubscriber(s, mapper, delayErrors, maxConcurrency, bufferSize); + return new MergeSubscriber<>(s, mapper, delayErrors, maxConcurrency, bufferSize); } static final class MergeSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { @@ -76,7 +76,7 @@ static final class MergeSubscriber extends AtomicInteger implements Flowab volatile boolean cancelled; - final AtomicReference[]> subscribers = new AtomicReference[]>(); + final AtomicReference[]> subscribers = new AtomicReference<>(); static final InnerSubscriber[] EMPTY = new InnerSubscriber[0]; @@ -157,7 +157,7 @@ public void onNext(T t) { } } } else { - InnerSubscriber inner = new InnerSubscriber(this, uniqueId++); + InnerSubscriber inner = new InnerSubscriber<>(this, uniqueId++); if (addInner(inner)) { p.subscribe(inner); } @@ -216,9 +216,9 @@ SimpleQueue getMainQueue() { SimplePlainQueue q = queue; if (q == null) { if (maxConcurrency == Integer.MAX_VALUE) { - q = new SpscLinkedArrayQueue(bufferSize); + q = new SpscLinkedArrayQueue<>(bufferSize); } else { - q = new SpscArrayQueue(maxConcurrency); + q = new SpscArrayQueue<>(maxConcurrency); } queue = q; } @@ -267,7 +267,7 @@ void tryEmitScalar(U value) { SimpleQueue getInnerQueue(InnerSubscriber inner) { SimpleQueue q = inner.queue; if (q == null) { - q = new SpscArrayQueue(bufferSize); + q = new SpscArrayQueue<>(bufferSize); inner.queue = q; } return q; @@ -298,7 +298,7 @@ void tryEmit(U value, InnerSubscriber inner) { } else { SimpleQueue q = inner.queue; if (q == null) { - q = new SpscArrayQueue(bufferSize); + q = new SpscArrayQueue<>(bufferSize); inner.queue = q; } if (!q.offer(value)) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java index 5c544add23..945e6a877e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletable.java @@ -50,7 +50,7 @@ public FlowableFlatMapCompletable(Flowable source, @Override protected void subscribeActual(Subscriber subscriber) { - source.subscribe(new FlatMapCompletableMainSubscriber(subscriber, mapper, delayErrors, maxConcurrency)); + source.subscribe(new FlatMapCompletableMainSubscriber<>(subscriber, mapper, delayErrors, maxConcurrency)); } static final class FlatMapCompletableMainSubscriber extends BasicIntQueueSubscription @@ -171,7 +171,7 @@ public void request(long n) { @Nullable @Override - public T poll() throws Exception { + public T poll() { return null; // always empty } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java index 94f0fa8653..00445c8018 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java @@ -53,12 +53,12 @@ public FlowableFlatMapCompletableCompletable(Flowable source, @Override protected void subscribeActual(CompletableObserver observer) { - source.subscribe(new FlatMapCompletableMainSubscriber(observer, mapper, delayErrors, maxConcurrency)); + source.subscribe(new FlatMapCompletableMainSubscriber<>(observer, mapper, delayErrors, maxConcurrency)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableFlatMapCompletable(source, mapper, delayErrors, maxConcurrency)); + return RxJavaPlugins.onAssembly(new FlowableFlatMapCompletable<>(source, mapper, delayErrors, maxConcurrency)); } static final class FlatMapCompletableMainSubscriber extends AtomicInteger diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java index 18c2e21f63..1036e73973 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybe.java @@ -50,7 +50,7 @@ public FlowableFlatMapMaybe(Flowable source, Function s) { - source.subscribe(new FlatMapMaybeSubscriber(s, mapper, delayErrors, maxConcurrency)); + source.subscribe(new FlatMapMaybeSubscriber<>(s, mapper, delayErrors, maxConcurrency)); } static final class FlatMapMaybeSubscriber @@ -91,7 +91,7 @@ static final class FlatMapMaybeSubscriber this.set = new CompositeDisposable(); this.errors = new AtomicThrowable(); this.active = new AtomicInteger(1); - this.queue = new AtomicReference>(); + this.queue = new AtomicReference<>(); } @Override @@ -210,7 +210,7 @@ SpscLinkedArrayQueue getOrCreateQueue() { if (current != null) { return current; } - current = new SpscLinkedArrayQueue(Flowable.bufferSize()); + current = new SpscLinkedArrayQueue<>(Flowable.bufferSize()); if (queue.compareAndSet(null, current)) { return current; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java index 366b48be09..d0c9002669 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingle.java @@ -50,7 +50,7 @@ public FlowableFlatMapSingle(Flowable source, Function s) { - source.subscribe(new FlatMapSingleSubscriber(s, mapper, delayErrors, maxConcurrency)); + source.subscribe(new FlatMapSingleSubscriber<>(s, mapper, delayErrors, maxConcurrency)); } static final class FlatMapSingleSubscriber @@ -91,7 +91,7 @@ static final class FlatMapSingleSubscriber this.set = new CompositeDisposable(); this.errors = new AtomicThrowable(); this.active = new AtomicInteger(1); - this.queue = new AtomicReference>(); + this.queue = new AtomicReference<>(); } @Override @@ -210,7 +210,7 @@ SpscLinkedArrayQueue getOrCreateQueue() { if (current != null) { return current; } - current = new SpscLinkedArrayQueue(Flowable.bufferSize()); + current = new SpscLinkedArrayQueue<>(Flowable.bufferSize()); if (queue.compareAndSet(null, current)) { return current; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java index b275337841..06f0b650e6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterable.java @@ -76,7 +76,7 @@ public void subscribeActual(Subscriber s) { return; } - source.subscribe(new FlattenIterableSubscriber(s, mapper, prefetch)); + source.subscribe(new FlattenIterableSubscriber<>(s, mapper, prefetch)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java index 83371ab447..9b9a4c66f4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArray.java @@ -33,10 +33,10 @@ public FlowableFromArray(T[] array) { @Override public void subscribeActual(Subscriber s) { if (s instanceof ConditionalSubscriber) { - s.onSubscribe(new ArrayConditionalSubscription( + s.onSubscribe(new ArrayConditionalSubscription<>( (ConditionalSubscriber)s, array)); } else { - s.onSubscribe(new ArraySubscription(s, array)); + s.onSubscribe(new ArraySubscription<>(s, array)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java index 80afc65910..603f09abae 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallable.java @@ -32,7 +32,7 @@ public FlowableFromCallable(Callable callable) { @Override public void subscribeActual(Subscriber s) { - DeferredScalarSubscription deferred = new DeferredScalarSubscription(s); + DeferredScalarSubscription deferred = new DeferredScalarSubscription<>(s); s.onSubscribe(deferred); T t; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java index 8356c92915..57dc02774f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromFuture.java @@ -35,7 +35,7 @@ public FlowableFromFuture(Future future, long timeout, TimeUnit uni @Override public void subscribeActual(Subscriber s) { - DeferredScalarSubscription deferred = new DeferredScalarSubscription(s); + DeferredScalarSubscription deferred = new DeferredScalarSubscription<>(s); s.onSubscribe(deferred); T v; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java index e88fd35c73..105c6b6ee2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromObservable.java @@ -26,7 +26,7 @@ public FlowableFromObservable(Observable upstream) { @Override protected void subscribeActual(Subscriber s) { - upstream.subscribe(new SubscriberObserver(s)); + upstream.subscribe(new SubscriberObserver<>(s)); } static final class SubscriberObserver implements Observer, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java index 7be86d618b..84fbae7eec 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplier.java @@ -38,7 +38,7 @@ public FlowableFromSupplier(Supplier supplier) { @Override public void subscribeActual(Subscriber s) { - DeferredScalarSubscription deferred = new DeferredScalarSubscription(s); + DeferredScalarSubscription deferred = new DeferredScalarSubscription<>(s); s.onSubscribe(deferred); T t; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java index 893ec19ff9..2feda7ad97 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGenerate.java @@ -48,7 +48,7 @@ public void subscribeActual(Subscriber s) { return; } - s.onSubscribe(new GeneratorSubscription(s, generator, disposeState, state)); + s.onSubscribe(new GeneratorSubscription<>(s, generator, disposeState, state)); } static final class GeneratorSubscription diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java index 85c7d08289..3cb84d4d6b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java @@ -56,10 +56,10 @@ protected void subscribeActual(Subscriber> s) { try { if (mapFactory == null) { evictedGroups = null; - groups = new ConcurrentHashMap>(); + groups = new ConcurrentHashMap<>(); } else { - evictedGroups = new ConcurrentLinkedQueue>(); - Consumer evictionAction = (Consumer) new EvictionAction(evictedGroups); + evictedGroups = new ConcurrentLinkedQueue<>(); + Consumer evictionAction = (Consumer) new EvictionAction<>(evictedGroups); groups = (Map) mapFactory.apply(evictionAction); } } catch (Throwable e) { @@ -69,7 +69,7 @@ protected void subscribeActual(Subscriber> s) { return; } GroupBySubscriber subscriber = - new GroupBySubscriber(s, keySelector, valueSelector, bufferSize, delayError, groups, evictedGroups); + new GroupBySubscriber<>(s, keySelector, valueSelector, bufferSize, delayError, groups, evictedGroups); source.subscribe(subscriber); } @@ -327,8 +327,8 @@ static final class GroupedUnicast extends GroupedFlowable { final State state; public static GroupedUnicast createWith(K key, int bufferSize, GroupBySubscriber parent, boolean delayError) { - State state = new State(bufferSize, parent, key, delayError); - return new GroupedUnicast(key, state); + State state = new State<>(bufferSize, parent, key, delayError); + return new GroupedUnicast<>(key, state); } protected GroupedUnicast(K key, State state) { @@ -370,7 +370,7 @@ static final class State extends BasicIntQueueSubscription implements P final AtomicBoolean cancelled = new AtomicBoolean(); - final AtomicReference> actual = new AtomicReference>(); + final AtomicReference> actual = new AtomicReference<>(); boolean outputFused; int produced; @@ -383,7 +383,7 @@ static final class State extends BasicIntQueueSubscription implements P static final int ABANDONED_HAS_SUBSCRIBER = ABANDONED | HAS_SUBSCRIBER; State(int bufferSize, GroupBySubscriber parent, K key, boolean delayError) { - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); this.parent = parent; this.key = key; this.delayError = delayError; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java index ccd80c53d9..a950de7a96 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoin.java @@ -59,7 +59,7 @@ public FlowableGroupJoin( protected void subscribeActual(Subscriber s) { GroupJoinSubscription parent = - new GroupJoinSubscription(s, leftEnd, rightEnd, resultSelector); + new GroupJoinSubscription<>(s, leftEnd, rightEnd, resultSelector); s.onSubscribe(parent); @@ -132,10 +132,10 @@ static final class GroupJoinSubscription this.downstream = actual; this.requested = new AtomicLong(); this.disposables = new CompositeDisposable(); - this.queue = new SpscLinkedArrayQueue(bufferSize()); - this.lefts = new LinkedHashMap>(); - this.rights = new LinkedHashMap(); - this.error = new AtomicReference(); + this.queue = new SpscLinkedArrayQueue<>(bufferSize()); + this.lefts = new LinkedHashMap<>(); + this.rights = new LinkedHashMap<>(); + this.error = new AtomicReference<>(); this.leftEnd = leftEnd; this.rightEnd = rightEnd; this.resultSelector = resultSelector; @@ -239,7 +239,7 @@ void drain() { @SuppressWarnings("unchecked") TLeft left = (TLeft)val; - UnicastProcessor up = UnicastProcessor.create(); + UnicastProcessor up = UnicastProcessor.create(); int idx = leftIndex++; lefts.put(idx, up); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java index 512269f58f..17d84f178a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableHide.java @@ -32,7 +32,7 @@ public FlowableHide(Flowable source) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new HideSubscriber(s)); + source.subscribe(new HideSubscriber<>(s)); } static final class HideSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java index c30935c569..9afee2e50d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElements.java @@ -28,7 +28,7 @@ public FlowableIgnoreElements(Flowable source) { @Override protected void subscribeActual(final Subscriber t) { - source.subscribe(new IgnoreElementsSubscriber(t)); + source.subscribe(new IgnoreElementsSubscriber<>(t)); } static final class IgnoreElementsSubscriber implements FlowableSubscriber, QueueSubscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java index e68e5dd784..4eaced342e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsCompletable.java @@ -31,12 +31,12 @@ public FlowableIgnoreElementsCompletable(Flowable source) { @Override protected void subscribeActual(final CompletableObserver t) { - source.subscribe(new IgnoreElementsSubscriber(t)); + source.subscribe(new IgnoreElementsSubscriber<>(t)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableIgnoreElements(source)); + return RxJavaPlugins.onAssembly(new FlowableIgnoreElements<>(source)); } static final class IgnoreElementsSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java index f8f97191fd..41dc08d920 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelper.java @@ -47,7 +47,7 @@ public S apply(S t1, Emitter t2) throws Throwable { } public static BiFunction, S> simpleGenerator(Consumer> consumer) { - return new SimpleGenerator(consumer); + return new SimpleGenerator<>(consumer); } static final class SimpleBiGenerator implements BiFunction, S> { @@ -65,7 +65,7 @@ public S apply(S t1, Emitter t2) throws Throwable { } public static BiFunction, S> simpleBiGenerator(BiConsumer> consumer) { - return new SimpleBiGenerator(consumer); + return new SimpleBiGenerator<>(consumer); } static final class ItemDelayFunction implements Function> { @@ -78,12 +78,12 @@ static final class ItemDelayFunction implements Function> @Override public Publisher apply(final T v) throws Throwable { Publisher p = Objects.requireNonNull(itemDelay.apply(v), "The itemDelay returned a null Publisher"); - return new FlowableTakePublisher(p, 1).map(Functions.justFunction(v)).defaultIfEmpty(v); + return new FlowableTakePublisher<>(p, 1).map(Functions.justFunction(v)).defaultIfEmpty(v); } } public static Function> itemDelay(final Function> itemDelay) { - return new ItemDelayFunction(itemDelay); + return new ItemDelayFunction<>(itemDelay); } static final class SubscriberOnNext implements Consumer { @@ -94,7 +94,7 @@ static final class SubscriberOnNext implements Consumer { } @Override - public void accept(T v) throws Exception { + public void accept(T v) { subscriber.onNext(v); } } @@ -107,7 +107,7 @@ static final class SubscriberOnError implements Consumer { } @Override - public void accept(Throwable v) throws Exception { + public void accept(Throwable v) { subscriber.onError(v); } } @@ -120,21 +120,21 @@ static final class SubscriberOnComplete implements Action { } @Override - public void run() throws Exception { + public void run() { subscriber.onComplete(); } } public static Consumer subscriberOnNext(Subscriber subscriber) { - return new SubscriberOnNext(subscriber); + return new SubscriberOnNext<>(subscriber); } public static Consumer subscriberOnError(Subscriber subscriber) { - return new SubscriberOnError(subscriber); + return new SubscriberOnError<>(subscriber); } public static Action subscriberOnComplete(Subscriber subscriber) { - return new SubscriberOnComplete(subscriber); + return new SubscriberOnComplete<>(subscriber); } static final class FlatMapWithCombinerInner implements Function { @@ -166,14 +166,14 @@ static final class FlatMapWithCombinerOuter implements Function apply(final T t) throws Throwable { @SuppressWarnings("unchecked") Publisher u = (Publisher)Objects.requireNonNull(mapper.apply(t), "The mapper returned a null Publisher"); - return new FlowableMapPublisher(u, new FlatMapWithCombinerInner(combiner, t)); + return new FlowableMapPublisher<>(u, new FlatMapWithCombinerInner(combiner, t)); } } public static Function> flatMapWithCombiner( final Function> mapper, final BiFunction combiner) { - return new FlatMapWithCombinerOuter(combiner, mapper); + return new FlatMapWithCombinerOuter<>(combiner, mapper); } static final class FlatMapIntoIterable implements Function> { @@ -185,34 +185,34 @@ static final class FlatMapIntoIterable implements Function @Override public Publisher apply(T t) throws Throwable { - return new FlowableFromIterable(Objects.requireNonNull(mapper.apply(t), "The mapper returned a null Iterable")); + return new FlowableFromIterable<>(Objects.requireNonNull(mapper.apply(t), "The mapper returned a null Iterable")); } } public static Function> flatMapIntoIterable(final Function> mapper) { - return new FlatMapIntoIterable(mapper); + return new FlatMapIntoIterable<>(mapper); } public static Supplier> replaySupplier(final Flowable parent) { - return new ReplaySupplier(parent); + return new ReplaySupplier<>(parent); } public static Supplier> replaySupplier(final Flowable parent, final int bufferSize, boolean eagerTruncate) { - return new BufferedReplaySupplier(parent, bufferSize, eagerTruncate); + return new BufferedReplaySupplier<>(parent, bufferSize, eagerTruncate); } public static Supplier> replaySupplier(final Flowable parent, final int bufferSize, final long time, final TimeUnit unit, final Scheduler scheduler, boolean eagerTruncate) { - return new BufferedTimedReplay(parent, bufferSize, time, unit, scheduler, eagerTruncate); + return new BufferedTimedReplay<>(parent, bufferSize, time, unit, scheduler, eagerTruncate); } public static Supplier> replaySupplier(final Flowable parent, final long time, final TimeUnit unit, final Scheduler scheduler, boolean eagerTruncate) { - return new TimedReplay(parent, time, unit, scheduler, eagerTruncate); + return new TimedReplay<>(parent, time, unit, scheduler, eagerTruncate); } public enum RequestMax implements Consumer { INSTANCE; @Override - public void accept(Subscription t) throws Exception { + public void accept(Subscription t) { t.request(Long.MAX_VALUE); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java index 44e735be37..9ef04ea11c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInterval.java @@ -66,7 +66,7 @@ static final class IntervalSubscriber extends AtomicLong long count; - final AtomicReference resource = new AtomicReference(); + final AtomicReference resource = new AtomicReference<>(); IntervalSubscriber(Subscriber downstream) { this.downstream = downstream; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java index 83ff94ecaa..e9580f40c6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalRange.java @@ -71,7 +71,7 @@ static final class IntervalRangeSubscriber extends AtomicLong long count; - final AtomicReference resource = new AtomicReference(); + final AtomicReference resource = new AtomicReference<>(); IntervalRangeSubscriber(Subscriber actual, long start, long end) { this.downstream = actual; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java index df8eff7049..01cf71023f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJoin.java @@ -56,7 +56,7 @@ public FlowableJoin( protected void subscribeActual(Subscriber s) { JoinSubscription parent = - new JoinSubscription(s, leftEnd, rightEnd, resultSelector); + new JoinSubscription<>(s, leftEnd, rightEnd, resultSelector); s.onSubscribe(parent); @@ -116,10 +116,10 @@ static final class JoinSubscription this.downstream = actual; this.requested = new AtomicLong(); this.disposables = new CompositeDisposable(); - this.queue = new SpscLinkedArrayQueue(bufferSize()); - this.lefts = new LinkedHashMap(); - this.rights = new LinkedHashMap(); - this.error = new AtomicReference(); + this.queue = new SpscLinkedArrayQueue<>(bufferSize()); + this.lefts = new LinkedHashMap<>(); + this.rights = new LinkedHashMap<>(); + this.error = new AtomicReference<>(); this.leftEnd = leftEnd; this.rightEnd = rightEnd; this.resultSelector = resultSelector; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java index d498befefc..d17c9644fa 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableJust.java @@ -31,7 +31,7 @@ public FlowableJust(final T value) { @Override protected void subscribeActual(Subscriber s) { - s.onSubscribe(new ScalarSubscription(s, value)); + s.onSubscribe(new ScalarSubscription<>(s, value)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java index 1c6a46f71c..936e68c211 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastMaybe.java @@ -36,7 +36,7 @@ public FlowableLastMaybe(Publisher source) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new LastSubscriber(observer)); + source.subscribe(new LastSubscriber<>(observer)); } static final class LastSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java index 7694067609..70346f3555 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLastSingle.java @@ -42,7 +42,7 @@ public FlowableLastSingle(Publisher source, T defaultItem) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new LastSubscriber(observer, defaultItem)); + source.subscribe(new LastSubscriber<>(observer, defaultItem)); } static final class LastSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java index cdfb0b0bb5..b01d6dc5a0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotification.java @@ -41,7 +41,7 @@ public FlowableMapNotification( @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new MapNotificationSubscriber(s, onNextMapper, onErrorMapper, onCompleteSupplier)); + source.subscribe(new MapNotificationSubscriber<>(s, onNextMapper, onErrorMapper, onCompleteSupplier)); } static final class MapNotificationSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java index e3e23c18e5..2b361427b1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterialize.java @@ -27,7 +27,7 @@ public FlowableMaterialize(Flowable source) { @Override protected void subscribeActual(Subscriber> s) { - source.subscribe(new MaterializeSubscriber(s)); + source.subscribe(new MaterializeSubscriber<>(s)); } static final class MaterializeSubscriber extends SinglePostCompleteSubscriber> { @@ -46,12 +46,12 @@ public void onNext(T t) { @Override public void onError(Throwable t) { - complete(Notification.createOnError(t)); + complete(Notification.createOnError(t)); } @Override public void onComplete() { - complete(Notification.createOnComplete()); + complete(Notification.createOnComplete()); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java index efb978083c..a0725a1d64 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletable.java @@ -41,7 +41,7 @@ public FlowableMergeWithCompletable(Flowable source, CompletableSource other) @Override protected void subscribeActual(Subscriber subscriber) { - MergeWithSubscriber parent = new MergeWithSubscriber(subscriber); + MergeWithSubscriber parent = new MergeWithSubscriber<>(subscriber); subscriber.onSubscribe(parent); source.subscribe(parent); other.subscribe(parent.otherObserver); @@ -68,7 +68,7 @@ static final class MergeWithSubscriber extends AtomicInteger MergeWithSubscriber(Subscriber downstream) { this.downstream = downstream; - this.mainSubscription = new AtomicReference(); + this.mainSubscription = new AtomicReference<>(); this.otherObserver = new OtherObserver(this); this.errors = new AtomicThrowable(); this.requested = new AtomicLong(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java index 4ad7f92d07..7d3be91bea 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybe.java @@ -43,7 +43,7 @@ public FlowableMergeWithMaybe(Flowable source, MaybeSource other @Override protected void subscribeActual(Subscriber subscriber) { - MergeWithObserver parent = new MergeWithObserver(subscriber); + MergeWithObserver parent = new MergeWithObserver<>(subscriber); subscriber.onSubscribe(parent); source.subscribe(parent); other.subscribe(parent.otherObserver); @@ -88,8 +88,8 @@ static final class MergeWithObserver extends AtomicInteger MergeWithObserver(Subscriber downstream) { this.downstream = downstream; - this.mainSubscription = new AtomicReference(); - this.otherObserver = new OtherObserver(this); + this.mainSubscription = new AtomicReference<>(); + this.otherObserver = new OtherObserver<>(this); this.errors = new AtomicThrowable(); this.requested = new AtomicLong(); this.prefetch = bufferSize(); @@ -211,7 +211,7 @@ void otherComplete() { SimplePlainQueue getOrCreateQueue() { SimplePlainQueue q = queue; if (q == null) { - q = new SpscArrayQueue(bufferSize()); + q = new SpscArrayQueue<>(bufferSize()); queue = q; } return q; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java index 33fe6b8454..997ad3fa2e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingle.java @@ -43,7 +43,7 @@ public FlowableMergeWithSingle(Flowable source, SingleSource oth @Override protected void subscribeActual(Subscriber subscriber) { - MergeWithObserver parent = new MergeWithObserver(subscriber); + MergeWithObserver parent = new MergeWithObserver<>(subscriber); subscriber.onSubscribe(parent); source.subscribe(parent); other.subscribe(parent.otherObserver); @@ -88,8 +88,8 @@ static final class MergeWithObserver extends AtomicInteger MergeWithObserver(Subscriber downstream) { this.downstream = downstream; - this.mainSubscription = new AtomicReference(); - this.otherObserver = new OtherObserver(this); + this.mainSubscription = new AtomicReference<>(); + this.otherObserver = new OtherObserver<>(this); this.errors = new AtomicThrowable(); this.requested = new AtomicLong(); this.prefetch = bufferSize(); @@ -206,7 +206,7 @@ void otherError(Throwable ex) { SimplePlainQueue getOrCreateQueue() { SimplePlainQueue q = queue; if (q == null) { - q = new SpscArrayQueue(bufferSize()); + q = new SpscArrayQueue<>(bufferSize()); queue = q; } return q; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java index 66605c9520..3a4f237e5b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOn.java @@ -50,10 +50,10 @@ public void subscribeActual(Subscriber s) { Worker worker = scheduler.createWorker(); if (s instanceof ConditionalSubscriber) { - source.subscribe(new ObserveOnConditionalSubscriber( + source.subscribe(new ObserveOnConditionalSubscriber<>( (ConditionalSubscriber) s, worker, delayError, prefetch)); } else { - source.subscribe(new ObserveOnSubscriber(s, worker, delayError, prefetch)); + source.subscribe(new ObserveOnSubscriber<>(s, worker, delayError, prefetch)); } } @@ -289,7 +289,7 @@ public void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(prefetch); + queue = new SpscArrayQueue<>(prefetch); downstream.onSubscribe(this); @@ -533,7 +533,7 @@ public void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(prefetch); + queue = new SpscArrayQueue<>(prefetch); downstream.onSubscribe(this); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java index df04ac54db..19d28291ba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBuffer.java @@ -43,7 +43,7 @@ public FlowableOnBackpressureBuffer(Flowable source, int bufferSize, boolean @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new BackpressureBufferSubscriber(s, bufferSize, unbounded, delayError, onOverflow)); + source.subscribe(new BackpressureBufferSubscriber<>(s, bufferSize, unbounded, delayError, onOverflow)); } static final class BackpressureBufferSubscriber extends BasicIntQueueSubscription implements FlowableSubscriber { @@ -75,9 +75,9 @@ static final class BackpressureBufferSubscriber extends BasicIntQueueSubscrip SimplePlainQueue q; if (unbounded) { - q = new SpscLinkedArrayQueue(bufferSize); + q = new SpscLinkedArrayQueue<>(bufferSize); } else { - q = new SpscArrayQueue(bufferSize); + q = new SpscArrayQueue<>(bufferSize); } this.queue = q; @@ -255,7 +255,7 @@ public int requestFusion(int mode) { @Nullable @Override - public T poll() throws Exception { + public T poll() { return queue.poll(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java index 70b65ab39a..6e458356b6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java @@ -48,7 +48,7 @@ public FlowableOnBackpressureBufferStrategy(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new OnBackpressureBufferStrategySubscriber(s, onOverflow, strategy, bufferSize)); + source.subscribe(new OnBackpressureBufferStrategySubscriber<>(s, onOverflow, strategy, bufferSize)); } static final class OnBackpressureBufferStrategySubscriber @@ -83,7 +83,7 @@ static final class OnBackpressureBufferStrategySubscriber this.strategy = strategy; this.bufferSize = bufferSize; this.requested = new AtomicLong(); - this.deque = new ArrayDeque(); + this.deque = new ArrayDeque<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java index 8f3f2d4946..0db3cd3cc2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDrop.java @@ -45,7 +45,7 @@ public void accept(T t) { @Override protected void subscribeActual(Subscriber s) { - this.source.subscribe(new BackpressureDropSubscriber(s, onDrop)); + this.source.subscribe(new BackpressureDropSubscriber<>(s, onDrop)); } static final class BackpressureDropSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java index 10304a4b84..b85e1281fb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureError.java @@ -31,7 +31,7 @@ public FlowableOnBackpressureError(Flowable source) { @Override protected void subscribeActual(Subscriber s) { - this.source.subscribe(new BackpressureErrorSubscriber(s)); + this.source.subscribe(new BackpressureErrorSubscriber<>(s)); } static final class BackpressureErrorSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java index b7ba9116a2..6123475ef0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatest.java @@ -29,7 +29,7 @@ public FlowableOnBackpressureLatest(Flowable source) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new BackpressureLatestSubscriber(s)); + source.subscribe(new BackpressureLatestSubscriber<>(s)); } static final class BackpressureLatestSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { @@ -47,7 +47,7 @@ static final class BackpressureLatestSubscriber extends AtomicInteger impleme final AtomicLong requested = new AtomicLong(); - final AtomicReference current = new AtomicReference(); + final AtomicReference current = new AtomicReference<>(); BackpressureLatestSubscriber(Subscriber downstream) { this.downstream = downstream; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java index 1d939022b4..7c9de4a748 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorNext.java @@ -34,7 +34,7 @@ public FlowableOnErrorNext(Flowable source, @Override protected void subscribeActual(Subscriber s) { - OnErrorNextSubscriber parent = new OnErrorNextSubscriber(s, nextSupplier); + OnErrorNextSubscriber parent = new OnErrorNextSubscriber<>(s, nextSupplier); s.onSubscribe(parent); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java index 4a908cc113..4fe88985a4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturn.java @@ -31,7 +31,7 @@ public FlowableOnErrorReturn(Flowable source, Function s) { - source.subscribe(new OnErrorReturnSubscriber(s, valueSupplier)); + source.subscribe(new OnErrorReturnSubscriber<>(s, valueSupplier)); } static final class OnErrorReturnSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java index 452dc83cce..49e75fc1fd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublish.java @@ -34,7 +34,7 @@ * completes or the connection is disposed. *

* The difference to FlowablePublish is that when the upstream terminates, - * late subscriberss will receive that terminal event until the connection is + * late subscribers will receive that terminal event until the connection is * disposed and the ConnectableFlowable is reset to its fresh state. * * @param the element type @@ -52,7 +52,7 @@ public final class FlowablePublish extends ConnectableFlowable public FlowablePublish(Publisher source, int bufferSize) { this.source = source; this.bufferSize = bufferSize; - this.current = new AtomicReference>(); + this.current = new AtomicReference<>(); } @Override @@ -61,8 +61,8 @@ public Publisher source() { } /** - * The internal buffer size of this FloawblePublishAlt operator. - * @return The internal buffer size of this FloawblePublishAlt operator. + * The internal buffer size of this FlowablePublishAlt operator. + * @return The internal buffer size of this FlowablePublishAlt operator. */ public int publishBufferSize() { return bufferSize; @@ -77,7 +77,7 @@ public void connect(Consumer connection) { conn = current.get(); if (conn == null || conn.isDisposed()) { - PublishConnection fresh = new PublishConnection(current, bufferSize); + PublishConnection fresh = new PublishConnection<>(current, bufferSize); if (!current.compareAndSet(conn, fresh)) { continue; } @@ -109,7 +109,7 @@ protected void subscribeActual(Subscriber s) { // don't create a fresh connection if the current is disposed if (conn == null) { - PublishConnection fresh = new PublishConnection(current, bufferSize); + PublishConnection fresh = new PublishConnection<>(current, bufferSize); if (!current.compareAndSet(conn, fresh)) { continue; } @@ -119,7 +119,7 @@ protected void subscribeActual(Subscriber s) { break; } - InnerSubscription inner = new InnerSubscription(s, conn); + InnerSubscription inner = new InnerSubscription<>(s, conn); s.onSubscribe(inner); if (conn.add(inner)) { @@ -180,10 +180,10 @@ static final class PublishConnection @SuppressWarnings("unchecked") PublishConnection(AtomicReference> current, int bufferSize) { this.current = current; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.connect = new AtomicBoolean(); this.bufferSize = bufferSize; - this.subscribers = new AtomicReference[]>(EMPTY); + this.subscribers = new AtomicReference<>(EMPTY); } @SuppressWarnings("unchecked") @@ -222,7 +222,7 @@ public void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(bufferSize); + queue = new SpscArrayQueue<>(bufferSize); s.request(bufferSize); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java index 702955bf02..05e0e7a907 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticast.java @@ -55,7 +55,7 @@ public FlowablePublishMulticast(Flowable source, @Override protected void subscribeActual(Subscriber s) { - MulticastProcessor mp = new MulticastProcessor(prefetch, delayError); + MulticastProcessor mp = new MulticastProcessor<>(prefetch, delayError); Publisher other; @@ -67,7 +67,7 @@ protected void subscribeActual(Subscriber s) { return; } - OutputCanceller out = new OutputCanceller(s, mp); + OutputCanceller out = new OutputCanceller<>(s, mp); other.subscribe(out); @@ -159,8 +159,8 @@ static final class MulticastProcessor extends Flowable implements Flowable this.limit = prefetch - (prefetch >> 2); // request after 75% consumption this.delayError = delayError; this.wip = new AtomicInteger(); - this.upstream = new AtomicReference(); - this.subscribers = new AtomicReference[]>(EMPTY); + this.upstream = new AtomicReference<>(); + this.subscribers = new AtomicReference<>(EMPTY); } @Override @@ -293,7 +293,7 @@ void remove(MulticastSubscription s) { @Override protected void subscribeActual(Subscriber s) { - MulticastSubscription ms = new MulticastSubscription(s, this); + MulticastSubscription ms = new MulticastSubscription<>(s, this); s.onSubscribe(ms); if (add(ms)) { if (ms.isCancelled()) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java index 9d3d3f4794..2aa1d71db0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduce.java @@ -40,7 +40,7 @@ public FlowableReduce(Flowable source, BiFunction reducer) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ReduceSubscriber(s, reducer)); + source.subscribe(new ReduceSubscriber<>(s, reducer)); } static final class ReduceSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java index 2de3b633fe..aded7967b8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceMaybe.java @@ -50,12 +50,12 @@ public Publisher source() { @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableReduce(source, reducer)); + return RxJavaPlugins.onAssembly(new FlowableReduce<>(source, reducer)); } @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new ReduceSubscriber(observer, reducer)); + source.subscribe(new ReduceSubscriber<>(observer, reducer)); } static final class ReduceSubscriber implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java index ec570639c6..715cb49c0a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceSeedSingle.java @@ -47,7 +47,7 @@ public FlowableReduceSeedSingle(Publisher source, R seed, BiFunction observer) { - source.subscribe(new ReduceSeedObserver(observer, reducer, seed)); + source.subscribe(new ReduceSeedObserver<>(observer, reducer, seed)); } static final class ReduceSeedObserver implements FlowableSubscriber, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java index 343d72c4e3..b2aaf836d7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReduceWithSingle.java @@ -55,6 +55,6 @@ protected void subscribeActual(SingleObserver observer) { EmptyDisposable.error(ex, observer); return; } - source.subscribe(new ReduceSeedObserver(observer, reducer, seed)); + source.subscribe(new ReduceSeedObserver<>(observer, reducer, seed)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java index e8f7f895ba..1bce5a4dd7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCount.java @@ -84,7 +84,7 @@ protected void subscribeActual(Subscriber s) { } } - source.subscribe(new RefCountSubscriber(s, this, conn)); + source.subscribe(new RefCountSubscriber<>(s, this, conn)); if (connect) { source.connect(conn); @@ -168,7 +168,7 @@ public void run() { } @Override - public void accept(Disposable t) throws Exception { + public void accept(Disposable t) { DisposableHelper.replace(this, t); synchronized (parent) { if (disconnectedEarly) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java index 092703b343..3acb03fb76 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeat.java @@ -32,7 +32,7 @@ public void subscribeActual(Subscriber s) { SubscriptionArbiter sa = new SubscriptionArbiter(false); s.onSubscribe(sa); - RepeatSubscriber rs = new RepeatSubscriber(s, count != Long.MAX_VALUE ? count - 1 : Long.MAX_VALUE, sa, source); + RepeatSubscriber rs = new RepeatSubscriber<>(s, count != Long.MAX_VALUE ? count - 1 : Long.MAX_VALUE, sa, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java index 9e24575c58..70df0e949d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatUntil.java @@ -34,7 +34,7 @@ public void subscribeActual(Subscriber s) { SubscriptionArbiter sa = new SubscriptionArbiter(false); s.onSubscribe(sa); - RepeatSubscriber rs = new RepeatSubscriber(s, until, sa, source); + RepeatSubscriber rs = new RepeatSubscriber<>(s, until, sa, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java index dcd807aa2a..5371930b5f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatWhen.java @@ -37,9 +37,9 @@ public FlowableRepeatWhen(Flowable source, @Override public void subscribeActual(Subscriber s) { - SerializedSubscriber z = new SerializedSubscriber(s); + SerializedSubscriber z = new SerializedSubscriber<>(s); - FlowableProcessor processor = UnicastProcessor.create(8).toSerialized(); + FlowableProcessor processor = UnicastProcessor.create(8).toSerialized(); Publisher when; @@ -51,9 +51,9 @@ public void subscribeActual(Subscriber s) { return; } - WhenReceiver receiver = new WhenReceiver(source); + WhenReceiver receiver = new WhenReceiver<>(source); - RepeatWhenSubscriber subscriber = new RepeatWhenSubscriber(z, processor, receiver); + RepeatWhenSubscriber subscriber = new RepeatWhenSubscriber<>(z, processor, receiver); receiver.subscriber = subscriber; @@ -80,7 +80,7 @@ static final class WhenReceiver WhenReceiver(Publisher source) { this.source = source; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.requested = new AtomicLong(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java index 6a352e2fc4..db8718a433 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplay.java @@ -56,7 +56,7 @@ public final class FlowableReplay extends ConnectableFlowable implements H public static Flowable multicastSelector( final Supplier> connectableFactory, final Function, ? extends Publisher> selector) { - return new MulticastFlowable(connectableFactory, selector); + return new MulticastFlowable<>(connectableFactory, selector); } /** @@ -83,7 +83,7 @@ public static ConnectableFlowable create(Flowable source, if (bufferSize == Integer.MAX_VALUE) { return createFrom(source); } - return create(source, new ReplayBufferSupplier(bufferSize, eagerTruncate)); + return create(source, new ReplayBufferSupplier<>(bufferSize, eagerTruncate)); } /** @@ -114,7 +114,7 @@ public static ConnectableFlowable create(Flowable source, */ public static ConnectableFlowable create(Flowable source, final long maxAge, final TimeUnit unit, final Scheduler scheduler, final int bufferSize, boolean eagerTruncate) { - return create(source, new ScheduledReplayBufferSupplier(bufferSize, maxAge, unit, scheduler, eagerTruncate)); + return create(source, new ScheduledReplayBufferSupplier<>(bufferSize, maxAge, unit, scheduler, eagerTruncate)); } /** @@ -126,9 +126,9 @@ public static ConnectableFlowable create(Flowable source, static ConnectableFlowable create(Flowable source, final Supplier> bufferFactory) { // the current connection to source needs to be shared between the operator and its onSubscribe call - final AtomicReference> curr = new AtomicReference>(); - Publisher onSubscribe = new ReplayPublisher(curr, bufferFactory); - return RxJavaPlugins.onAssembly(new FlowableReplay(onSubscribe, source, curr, bufferFactory)); + final AtomicReference> curr = new AtomicReference<>(); + Publisher onSubscribe = new ReplayPublisher<>(curr, bufferFactory); + return RxJavaPlugins.onAssembly(new FlowableReplay<>(onSubscribe, source, curr, bufferFactory)); } private FlowableReplay(Publisher onSubscribe, Flowable source, @@ -179,7 +179,7 @@ public void connect(Consumer connection) { } // create a new subscriber-to-source - ReplaySubscriber u = new ReplaySubscriber(buf); + ReplaySubscriber u = new ReplaySubscriber<>(buf); // try setting it as the current subscriber-to-source if (!current.compareAndSet(ps, u)) { // did not work, perhaps a new subscriber arrived @@ -255,7 +255,7 @@ static final class ReplaySubscriber ReplaySubscriber(ReplayBuffer buffer) { this.buffer = buffer; this.management = new AtomicInteger(); - this.subscribers = new AtomicReference[]>(EMPTY); + this.subscribers = new AtomicReference<>(EMPTY); this.shouldConnect = new AtomicBoolean(); } @@ -1004,7 +1004,7 @@ static final class SizeAndTimeBoundReplayBuffer extends BoundedReplayBuffer(value, terminal ? Long.MAX_VALUE : scheduler.now(unit), unit); + return new Timed<>(value, terminal ? Long.MAX_VALUE : scheduler.now(unit), unit); } @Override @@ -1128,7 +1128,7 @@ protected void subscribeActual(Subscriber child) { return; } - final SubscriberResourceWrapper srw = new SubscriberResourceWrapper(child); + final SubscriberResourceWrapper srw = new SubscriberResourceWrapper<>(child); observable.subscribe(srw); @@ -1187,7 +1187,7 @@ static final class ReplayBufferSupplier implements Supplier> @Override public ReplayBuffer get() { - return new SizeBoundReplayBuffer(bufferSize, eagerTruncate); + return new SizeBoundReplayBuffer<>(bufferSize, eagerTruncate); } } @@ -1209,7 +1209,7 @@ static final class ScheduledReplayBufferSupplier implements Supplier get() { - return new SizeAndTimeBoundReplayBuffer(bufferSize, maxAge, unit, scheduler, eagerTruncate); + return new SizeAndTimeBoundReplayBuffer<>(bufferSize, maxAge, unit, scheduler, eagerTruncate); } } @@ -1241,7 +1241,7 @@ public void subscribe(Subscriber child) { return; } // create a new subscriber to source - ReplaySubscriber u = new ReplaySubscriber(buf); + ReplaySubscriber u = new ReplaySubscriber<>(buf); // let's try setting it as the current subscriber-to-source if (!curr.compareAndSet(null, u)) { // didn't work, maybe someone else did it or the current subscriber @@ -1253,7 +1253,7 @@ public void subscribe(Subscriber child) { } // create the backpressure-managing producer for this child - InnerSubscription inner = new InnerSubscription(r, child); + InnerSubscription inner = new InnerSubscription<>(r, child); // the producer has been registered with the current subscriber-to-source so // at least it will receive the next terminal event // setting the producer will trigger the first request to be considered by @@ -1282,7 +1282,7 @@ public void subscribe(Subscriber child) { static final class DefaultUnboundedFactory implements Supplier { @Override public Object get() { - return new UnboundedReplayBuffer(16); + return new UnboundedReplayBuffer<>(16); } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java index 1a06e02bb6..62b4852849 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryBiPredicate.java @@ -36,7 +36,7 @@ public void subscribeActual(Subscriber s) { SubscriptionArbiter sa = new SubscriptionArbiter(false); s.onSubscribe(sa); - RetryBiSubscriber rs = new RetryBiSubscriber(s, predicate, sa, source); + RetryBiSubscriber rs = new RetryBiSubscriber<>(s, predicate, sa, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java index 07d7207d74..75350871c4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryPredicate.java @@ -38,7 +38,7 @@ public void subscribeActual(Subscriber s) { SubscriptionArbiter sa = new SubscriptionArbiter(false); s.onSubscribe(sa); - RetrySubscriber rs = new RetrySubscriber(s, count, predicate, sa, source); + RetrySubscriber rs = new RetrySubscriber<>(s, count, predicate, sa, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java index 7307664353..f4129d7be8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java @@ -36,7 +36,7 @@ public FlowableRetryWhen(Flowable source, @Override public void subscribeActual(Subscriber s) { - SerializedSubscriber z = new SerializedSubscriber(s); + SerializedSubscriber z = new SerializedSubscriber<>(s); FlowableProcessor processor = UnicastProcessor.create(8).toSerialized(); @@ -50,9 +50,9 @@ public void subscribeActual(Subscriber s) { return; } - WhenReceiver receiver = new WhenReceiver(source); + WhenReceiver receiver = new WhenReceiver<>(source); - RetryWhenSubscriber subscriber = new RetryWhenSubscriber(z, processor, receiver); + RetryWhenSubscriber subscriber = new RetryWhenSubscriber<>(z, processor, receiver); receiver.subscriber = subscriber; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java index 59a6ec3a14..4a20a2b95f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSamplePublisher.java @@ -37,11 +37,11 @@ public FlowableSamplePublisher(Publisher source, Publisher other, boolean @Override protected void subscribeActual(Subscriber s) { - SerializedSubscriber serial = new SerializedSubscriber(s); + SerializedSubscriber serial = new SerializedSubscriber<>(s); if (emitLast) { - source.subscribe(new SampleMainEmitLast(serial, other)); + source.subscribe(new SampleMainEmitLast<>(serial, other)); } else { - source.subscribe(new SampleMainNoLast(serial, other)); + source.subscribe(new SampleMainNoLast<>(serial, other)); } } @@ -54,7 +54,7 @@ abstract static class SamplePublisherSubscriber extends AtomicReference im final AtomicLong requested = new AtomicLong(); - final AtomicReference other = new AtomicReference(); + final AtomicReference other = new AtomicReference<>(); Subscription upstream; @@ -69,7 +69,7 @@ public void onSubscribe(Subscription s) { this.upstream = s; downstream.onSubscribe(this); if (other.get() == null) { - sampler.subscribe(new SamplerSubscriber(this)); + sampler.subscribe(new SamplerSubscriber<>(this)); s.request(Long.MAX_VALUE); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java index ea9a4d5ae2..17e1644749 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSampleTimed.java @@ -42,11 +42,11 @@ public FlowableSampleTimed(Flowable source, long period, TimeUnit unit, Sched @Override protected void subscribeActual(Subscriber s) { - SerializedSubscriber serial = new SerializedSubscriber(s); + SerializedSubscriber serial = new SerializedSubscriber<>(s); if (emitLast) { - source.subscribe(new SampleTimedEmitLast(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedEmitLast<>(serial, period, unit, scheduler)); } else { - source.subscribe(new SampleTimedNoLast(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedNoLast<>(serial, period, unit, scheduler)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java index d78e83a3d2..4abae183b4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMap.java @@ -87,7 +87,7 @@ public static boolean tryScalarXMapSubscribe(Publisher source, EmptySubscription.complete(subscriber); return true; } - subscriber.onSubscribe(new ScalarSubscription(subscriber, u)); + subscriber.onSubscribe(new ScalarSubscription<>(subscriber, u)); } else { r.subscribe(subscriber); } @@ -108,7 +108,7 @@ public static boolean tryScalarXMapSubscribe(Publisher source, * @return the new Flowable instance */ public static Flowable scalarXMap(final T value, final Function> mapper) { - return RxJavaPlugins.onAssembly(new ScalarXMapFlowable(value, mapper)); + return RxJavaPlugins.onAssembly(new ScalarXMapFlowable<>(value, mapper)); } /** @@ -155,7 +155,7 @@ public void subscribeActual(Subscriber s) { EmptySubscription.complete(s); return; } - s.onSubscribe(new ScalarSubscription(s, u)); + s.onSubscribe(new ScalarSubscription<>(s, u)); } else { other.subscribe(s); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java index 2fab24a484..0199189204 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScan.java @@ -32,7 +32,7 @@ public FlowableScan(Flowable source, BiFunction accumulator) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ScanSubscriber(s, accumulator)); + source.subscribe(new ScanSubscriber<>(s, accumulator)); } static final class ScanSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java index da0b1870da..21c88ab7bf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanSeed.java @@ -48,7 +48,7 @@ protected void subscribeActual(Subscriber s) { return; } - source.subscribe(new ScanSeedSubscriber(s, accumulator, r, bufferSize())); + source.subscribe(new ScanSeedSubscriber<>(s, accumulator, r, bufferSize())); } static final class ScanSeedSubscriber @@ -85,7 +85,7 @@ static final class ScanSeedSubscriber this.value = value; this.prefetch = prefetch; this.limit = prefetch - (prefetch >> 2); - this.queue = new SpscArrayQueue(prefetch); + this.queue = new SpscArrayQueue<>(prefetch); this.queue.offer(value); this.requested = new AtomicLong(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java index 05be9542be..cc65e1d37e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqual.java @@ -41,7 +41,7 @@ public FlowableSequenceEqual(Publisher first, Publisher s) { - EqualCoordinator parent = new EqualCoordinator(s, prefetch, comparer); + EqualCoordinator parent = new EqualCoordinator<>(s, prefetch, comparer); s.onSubscribe(parent); parent.subscribe(first, second); } @@ -79,8 +79,8 @@ static final class EqualCoordinator extends DeferredScalarSubscription(this, prefetch); - this.second = new EqualSubscriber(this, prefetch); + this.first = new EqualSubscriber<>(this, prefetch); + this.second = new EqualSubscriber<>(this, prefetch); this.errors = new AtomicThrowable(); } @@ -289,7 +289,7 @@ public void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(prefetch); + queue = new SpscArrayQueue<>(prefetch); s.request(prefetch); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java index 7761c93041..05d99e4e49 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualSingle.java @@ -43,14 +43,14 @@ public FlowableSequenceEqualSingle(Publisher first, Publisher observer) { - EqualCoordinator parent = new EqualCoordinator(observer, prefetch, comparer); + EqualCoordinator parent = new EqualCoordinator<>(observer, prefetch, comparer); observer.onSubscribe(parent); parent.subscribe(first, second); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableSequenceEqual(first, second, comparer, prefetch)); + return RxJavaPlugins.onAssembly(new FlowableSequenceEqual<>(first, second, comparer, prefetch)); } static final class EqualCoordinator @@ -76,8 +76,8 @@ static final class EqualCoordinator EqualCoordinator(SingleObserver actual, int prefetch, BiPredicate comparer) { this.downstream = actual; this.comparer = comparer; - this.first = new EqualSubscriber(this, prefetch); - this.second = new EqualSubscriber(this, prefetch); + this.first = new EqualSubscriber<>(this, prefetch); + this.second = new EqualSubscriber<>(this, prefetch); this.errors = new AtomicThrowable(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java index ec924bb0d1..2cd7df3369 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSerialized.java @@ -24,6 +24,6 @@ public FlowableSerialized(Flowable source) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SerializedSubscriber(s)); + source.subscribe(new SerializedSubscriber<>(s)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java index 11a27d372b..068385289a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingle.java @@ -35,7 +35,7 @@ public FlowableSingle(Flowable source, T defaultValue, boolean failOnEmpty) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SingleElementSubscriber(s, defaultValue, failOnEmpty)); + source.subscribe(new SingleElementSubscriber<>(s, defaultValue, failOnEmpty)); } static final class SingleElementSubscriber extends DeferredScalarSubscription diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java index 1d701014cb..fac74c9cd8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleMaybe.java @@ -31,12 +31,12 @@ public FlowableSingleMaybe(Flowable source) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new SingleElementSubscriber(observer)); + source.subscribe(new SingleElementSubscriber<>(observer)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableSingle(source, null, false)); + return RxJavaPlugins.onAssembly(new FlowableSingle<>(source, null, false)); } static final class SingleElementSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java index 50c4d06ccc..c24b45a760 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleSingle.java @@ -36,12 +36,12 @@ public FlowableSingleSingle(Flowable source, T defaultValue) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new SingleElementSubscriber(observer, defaultValue)); + source.subscribe(new SingleElementSubscriber<>(observer, defaultValue)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableSingle(source, defaultValue, true)); + return RxJavaPlugins.onAssembly(new FlowableSingle<>(source, defaultValue, true)); } static final class SingleElementSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java index f60d36e8f1..2aecef3e10 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkip.java @@ -27,7 +27,7 @@ public FlowableSkip(Flowable source, long n) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SkipSubscriber(s, n)); + source.subscribe(new SkipSubscriber<>(s, n)); } static final class SkipSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java index 8b3a6a2487..5908d6d0b0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLast.java @@ -30,7 +30,7 @@ public FlowableSkipLast(Flowable source, int skip) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SkipLastSubscriber(s, skip)); + source.subscribe(new SkipLastSubscriber<>(s, skip)); } static final class SkipLastSubscriber extends ArrayDeque implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java index 099c5ec59c..b56224cbdf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTimed.java @@ -41,7 +41,7 @@ public FlowableSkipLastTimed(Flowable source, long time, TimeUnit unit, Sched @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SkipLastTimedSubscriber(s, time, unit, scheduler, bufferSize, delayError)); + source.subscribe(new SkipLastTimedSubscriber<>(s, time, unit, scheduler, bufferSize, delayError)); } static final class SkipLastTimedSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { @@ -68,7 +68,7 @@ static final class SkipLastTimedSubscriber extends AtomicInteger implements F this.time = time; this.unit = unit; this.scheduler = scheduler; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); this.delayError = delayError; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java index 8052bc7fbf..8de843142c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipUntil.java @@ -31,7 +31,7 @@ public FlowableSkipUntil(Flowable source, Publisher other) { @Override protected void subscribeActual(Subscriber child) { - SkipUntilMainSubscriber parent = new SkipUntilMainSubscriber(child); + SkipUntilMainSubscriber parent = new SkipUntilMainSubscriber<>(child); child.onSubscribe(parent); other.subscribe(parent.other); @@ -57,7 +57,7 @@ static final class SkipUntilMainSubscriber extends AtomicInteger SkipUntilMainSubscriber(Subscriber downstream) { this.downstream = downstream; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.requested = new AtomicLong(); this.other = new OtherSubscriber(); this.error = new AtomicThrowable(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java index 7ed91df231..62ee5ebdbe 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipWhile.java @@ -29,7 +29,7 @@ public FlowableSkipWhile(Flowable source, Predicate predicate) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SkipWhileSubscriber(s, predicate)); + source.subscribe(new SkipWhileSubscriber<>(s, predicate)); } static final class SkipWhileSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java index 63394a09ab..b7fdd91e9f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOn.java @@ -42,7 +42,7 @@ public FlowableSubscribeOn(Flowable source, Scheduler scheduler, boolean nonS @Override public void subscribeActual(final Subscriber s) { Scheduler.Worker w = scheduler.createWorker(); - final SubscribeOnSubscriber sos = new SubscribeOnSubscriber(s, w, source, nonScheduledRequests); + final SubscribeOnSubscriber sos = new SubscribeOnSubscriber<>(s, w, source, nonScheduledRequests); s.onSubscribe(sos); w.schedule(sos); @@ -69,7 +69,7 @@ static final class SubscribeOnSubscriber extends AtomicReference this.downstream = actual; this.worker = worker; this.source = source; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.requested = new AtomicLong(); this.nonScheduledRequests = !requestOn; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java index a2e81eac58..b2ad9db0d0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmpty.java @@ -27,7 +27,7 @@ public FlowableSwitchIfEmpty(Flowable source, Publisher other) { @Override protected void subscribeActual(Subscriber s) { - SwitchIfEmptySubscriber parent = new SwitchIfEmptySubscriber(s, other); + SwitchIfEmptySubscriber parent = new SwitchIfEmptySubscriber<>(s, other); s.onSubscribe(parent.arbiter); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java index c618a0252b..7c6c1006ca 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchMap.java @@ -46,7 +46,7 @@ protected void subscribeActual(Subscriber s) { if (FlowableScalarXMap.tryScalarXMapSubscribe(source, s, mapper)) { return; } - source.subscribe(new SwitchMapSubscriber(s, mapper, bufferSize, delayErrors)); + source.subscribe(new SwitchMapSubscriber<>(s, mapper, bufferSize, delayErrors)); } static final class SwitchMapSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { @@ -64,13 +64,13 @@ static final class SwitchMapSubscriber extends AtomicInteger implements Fl Subscription upstream; - final AtomicReference> active = new AtomicReference>(); + final AtomicReference> active = new AtomicReference<>(); final AtomicLong requested = new AtomicLong(); static final SwitchMapInnerSubscriber CANCELLED; static { - CANCELLED = new SwitchMapInnerSubscriber(null, -1L, 1); + CANCELLED = new SwitchMapInnerSubscriber<>(null, -1L, 1); CANCELLED.cancel(); } @@ -118,7 +118,7 @@ public void onNext(T t) { return; } - SwitchMapInnerSubscriber nextInner = new SwitchMapInnerSubscriber(this, c, bufferSize); + SwitchMapInnerSubscriber nextInner = new SwitchMapInnerSubscriber<>(this, c, bufferSize); for (;;) { inner = active.get(); @@ -371,7 +371,7 @@ public void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(bufferSize); + queue = new SpscArrayQueue<>(bufferSize); s.request(bufferSize); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java index 9b8e995322..15d06f087f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTake.java @@ -32,7 +32,7 @@ public FlowableTake(Flowable source, long n) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new TakeSubscriber(s, n)); + source.subscribe(new TakeSubscriber<>(s, n)); } static final class TakeSubscriber @@ -105,12 +105,7 @@ public void request(long n) { if (r == 0L) { break; } - long toRequest; - if (r <= n) { - toRequest = r; - } else { - toRequest = n; - } + long toRequest = Math.min(r, n); long u = r - toRequest; if (compareAndSet(r, u)) { upstream.request(toRequest); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java index 5252bd808d..062135b47c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLast.java @@ -32,7 +32,7 @@ public FlowableTakeLast(Flowable source, int count) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new TakeLastSubscriber(s, count)); + source.subscribe(new TakeLastSubscriber<>(s, count)); } static final class TakeLastSubscriber extends ArrayDeque implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java index fb11b74c0c..e4b674704d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOne.java @@ -25,7 +25,7 @@ public FlowableTakeLastOne(Flowable source) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new TakeLastOneSubscriber(s)); + source.subscribe(new TakeLastOneSubscriber<>(s)); } static final class TakeLastOneSubscriber extends DeferredScalarSubscription diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java index 2538fc178e..a7c2ab3343 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimed.java @@ -45,7 +45,7 @@ public FlowableTakeLastTimed(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new TakeLastTimedSubscriber(s, count, time, unit, scheduler, bufferSize, delayError)); + source.subscribe(new TakeLastTimedSubscriber<>(s, count, time, unit, scheduler, bufferSize, delayError)); } static final class TakeLastTimedSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { @@ -74,7 +74,7 @@ static final class TakeLastTimedSubscriber extends AtomicInteger implements F this.time = time; this.unit = unit; this.scheduler = scheduler; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); this.delayError = delayError; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java index bda003e7da..9a30bda905 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakePublisher.java @@ -35,6 +35,6 @@ public FlowableTakePublisher(Publisher source, long limit) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new TakeSubscriber(s, limit)); + source.subscribe(new TakeSubscriber<>(s, limit)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java index 1bbe14cd57..9c927cca5d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntil.java @@ -30,7 +30,7 @@ public FlowableTakeUntil(Flowable source, Publisher other) { @Override protected void subscribeActual(Subscriber child) { - TakeUntilMainSubscriber parent = new TakeUntilMainSubscriber(child); + TakeUntilMainSubscriber parent = new TakeUntilMainSubscriber<>(child); child.onSubscribe(parent); other.subscribe(parent.other); @@ -55,7 +55,7 @@ static final class TakeUntilMainSubscriber extends AtomicInteger implements F TakeUntilMainSubscriber(Subscriber downstream) { this.downstream = downstream; this.requested = new AtomicLong(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.other = new OtherSubscriber(); this.error = new AtomicThrowable(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java index 8bb8f27531..a8ec19c22a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicate.java @@ -30,7 +30,7 @@ public FlowableTakeUntilPredicate(Flowable source, Predicate predi @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new InnerSubscriber(s, predicate)); + source.subscribe(new InnerSubscriber<>(s, predicate)); } static final class InnerSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java index ba9a115da8..5bcd8157d3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhile.java @@ -30,7 +30,7 @@ public FlowableTakeWhile(Flowable source, Predicate predicate) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new TakeWhileSubscriber(s, predicate)); + source.subscribe(new TakeWhileSubscriber<>(s, predicate)); } static final class TakeWhileSubscriber implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java index 4b1441b731..918e2ea6d7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleFirstTimed.java @@ -42,8 +42,8 @@ public FlowableThrottleFirstTimed(Flowable source, long timeout, TimeUnit uni @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new DebounceTimedSubscriber( - new SerializedSubscriber(s), + source.subscribe(new DebounceTimedSubscriber<>( + new SerializedSubscriber<>(s), timeout, unit, scheduler.createWorker())); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java index fe32addcc6..989eaaf4b2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableThrottleLatest.java @@ -56,7 +56,7 @@ public FlowableThrottleLatest(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ThrottleLatestSubscriber(s, timeout, unit, scheduler.createWorker(), emitLast)); + source.subscribe(new ThrottleLatestSubscriber<>(s, timeout, unit, scheduler.createWorker(), emitLast)); } static final class ThrottleLatestSubscriber @@ -100,7 +100,7 @@ static final class ThrottleLatestSubscriber this.unit = unit; this.worker = worker; this.emitLast = emitLast; - this.latest = new AtomicReference(); + this.latest = new AtomicReference<>(); this.requested = new AtomicLong(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java index 4f7c1e899b..eb9ec1fbd9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeInterval.java @@ -33,7 +33,7 @@ public FlowableTimeInterval(Flowable source, TimeUnit unit, Scheduler schedul @Override protected void subscribeActual(Subscriber> s) { - source.subscribe(new TimeIntervalSubscriber(s, unit, scheduler)); + source.subscribe(new TimeIntervalSubscriber<>(s, unit, scheduler)); } static final class TimeIntervalSubscriber implements FlowableSubscriber, Subscription { @@ -66,7 +66,7 @@ public void onNext(T t) { long last = lastTime; lastTime = now; long delta = now - last; - downstream.onNext(new Timed(t, delta, unit)); + downstream.onNext(new Timed<>(t, delta, unit)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java index c5879c2e74..976ab10a05 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeout.java @@ -47,12 +47,12 @@ public FlowableTimeout( @Override protected void subscribeActual(Subscriber s) { if (other == null) { - TimeoutSubscriber parent = new TimeoutSubscriber(s, itemTimeoutIndicator); + TimeoutSubscriber parent = new TimeoutSubscriber<>(s, itemTimeoutIndicator); s.onSubscribe(parent); parent.startFirstTimeout(firstTimeoutIndicator); source.subscribe(parent); } else { - TimeoutFallbackSubscriber parent = new TimeoutFallbackSubscriber(s, itemTimeoutIndicator, other); + TimeoutFallbackSubscriber parent = new TimeoutFallbackSubscriber<>(s, itemTimeoutIndicator, other); s.onSubscribe(parent); parent.startFirstTimeout(firstTimeoutIndicator); source.subscribe(parent); @@ -82,7 +82,7 @@ static final class TimeoutSubscriber extends AtomicLong this.downstream = actual; this.itemTimeoutIndicator = itemTimeoutIndicator; this.task = new SequentialDisposable(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.requested = new AtomicLong(); } @@ -212,7 +212,7 @@ static final class TimeoutFallbackSubscriber extends SubscriptionArbiter this.downstream = actual; this.itemTimeoutIndicator = itemTimeoutIndicator; this.task = new SequentialDisposable(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.fallback = fallback; this.index = new AtomicLong(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java index 8963788992..351099500e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTimed.java @@ -43,12 +43,12 @@ public FlowableTimeoutTimed(Flowable source, @Override protected void subscribeActual(Subscriber s) { if (other == null) { - TimeoutSubscriber parent = new TimeoutSubscriber(s, timeout, unit, scheduler.createWorker()); + TimeoutSubscriber parent = new TimeoutSubscriber<>(s, timeout, unit, scheduler.createWorker()); s.onSubscribe(parent); parent.startTimeout(0L); source.subscribe(parent); } else { - TimeoutFallbackSubscriber parent = new TimeoutFallbackSubscriber(s, timeout, unit, scheduler.createWorker(), other); + TimeoutFallbackSubscriber parent = new TimeoutFallbackSubscriber<>(s, timeout, unit, scheduler.createWorker(), other); s.onSubscribe(parent); parent.startTimeout(0L); source.subscribe(parent); @@ -80,7 +80,7 @@ static final class TimeoutSubscriber extends AtomicLong this.unit = unit; this.worker = worker; this.task = new SequentialDisposable(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.requested = new AtomicLong(); } @@ -203,7 +203,7 @@ static final class TimeoutFallbackSubscriber extends SubscriptionArbiter this.worker = worker; this.fallback = fallback; this.task = new SequentialDisposable(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.index = new AtomicLong(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java index 439fba1074..18d8a86de4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToList.java @@ -41,7 +41,7 @@ protected void subscribeActual(Subscriber s) { EmptySubscription.error(e, s); return; } - source.subscribe(new ToListSubscriber(s, coll)); + source.subscribe(new ToListSubscriber<>(s, coll)); } static final class ToListSubscriber> diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java index b90869ad62..aea4eb3270 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListSingle.java @@ -53,12 +53,12 @@ protected void subscribeActual(SingleObserver observer) { EmptyDisposable.error(e, observer); return; } - source.subscribe(new ToListSubscriber(observer, coll)); + source.subscribe(new ToListSubscriber<>(observer, coll)); } @Override public Flowable fuseToFlowable() { - return RxJavaPlugins.onAssembly(new FlowableToList(source, collectionSupplier)); + return RxJavaPlugins.onAssembly(new FlowableToList<>(source, collectionSupplier)); } static final class ToListSubscriber> diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java index 3a7d29a47b..ee9d8f3cc7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOn.java @@ -30,7 +30,7 @@ public FlowableUnsubscribeOn(Flowable source, Scheduler scheduler) { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new UnsubscribeSubscriber(s, scheduler)); + source.subscribe(new UnsubscribeSubscriber<>(s, scheduler)); } static final class UnsubscribeSubscriber extends AtomicBoolean implements FlowableSubscriber, Subscription { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java index 7e2e91c672..5a5b177d35 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsing.java @@ -68,7 +68,7 @@ public void subscribeActual(Subscriber s) { return; } - UsingSubscriber us = new UsingSubscriber(s, resource, disposer, eager); + UsingSubscriber us = new UsingSubscriber<>(s, resource, disposer, eager); source.subscribe(us); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java index ae027e2d04..e00ed99edf 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindow.java @@ -42,12 +42,12 @@ public FlowableWindow(Flowable source, long size, long skip, int bufferSize) @Override public void subscribeActual(Subscriber> s) { if (skip == size) { - source.subscribe(new WindowExactSubscriber(s, size, bufferSize)); + source.subscribe(new WindowExactSubscriber<>(s, size, bufferSize)); } else if (skip > size) { - source.subscribe(new WindowSkipSubscriber(s, size, skip, bufferSize)); + source.subscribe(new WindowSkipSubscriber<>(s, size, skip, bufferSize)); } else { - source.subscribe(new WindowOverlapSubscriber(s, size, skip, bufferSize)); + source.subscribe(new WindowOverlapSubscriber<>(s, size, skip, bufferSize)); } } @@ -96,10 +96,10 @@ public void onNext(T t) { if (i == 0) { getAndIncrement(); - w = UnicastProcessor.create(bufferSize, this); + w = UnicastProcessor.create(bufferSize, this); window = w; - intercept = new FlowableWindowSubscribeIntercept(w); + intercept = new FlowableWindowSubscribeIntercept<>(w); downstream.onNext(intercept); } @@ -216,10 +216,10 @@ public void onNext(T t) { if (i == 0) { getAndIncrement(); - w = UnicastProcessor.create(bufferSize, this); + w = UnicastProcessor.create(bufferSize, this); window = w; - intercept = new FlowableWindowSubscribeIntercept(w); + intercept = new FlowableWindowSubscribeIntercept<>(w); downstream.onNext(intercept); } @@ -339,8 +339,8 @@ static final class WindowOverlapSubscriber this.downstream = actual; this.size = size; this.skip = skip; - this.queue = new SpscLinkedArrayQueue>(bufferSize); - this.windows = new ArrayDeque>(); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); + this.windows = new ArrayDeque<>(); this.once = new AtomicBoolean(); this.firstRequest = new AtomicBoolean(); this.requested = new AtomicLong(); @@ -369,7 +369,7 @@ public void onNext(T t) { if (!cancelled) { getAndIncrement(); - newWindow = UnicastProcessor.create(bufferSize, this); + newWindow = UnicastProcessor.create(bufferSize, this); windows.offer(newWindow); } @@ -477,7 +477,7 @@ void drain() { break; } - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(t); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(t); a.onNext(intercept); if (intercept.tryAbandon()) { @@ -488,7 +488,7 @@ void drain() { if (e == r) { if (cancelled) { - continue outer; + continue; } if (checkTerminated(done, q.isEmpty(), a, q)) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java index 2e07d3eec8..c86d3faab1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundary.java @@ -38,7 +38,7 @@ public FlowableWindowBoundary(Flowable source, Publisher other, int capaci @Override protected void subscribeActual(Subscriber> subscriber) { - WindowBoundaryMainSubscriber parent = new WindowBoundaryMainSubscriber(subscriber, capacityHint); + WindowBoundaryMainSubscriber parent = new WindowBoundaryMainSubscriber<>(subscriber, capacityHint); subscriber.onSubscribe(parent); @@ -84,10 +84,10 @@ static final class WindowBoundaryMainSubscriber WindowBoundaryMainSubscriber(Subscriber> downstream, int capacityHint) { this.downstream = downstream; this.capacityHint = capacityHint; - this.boundarySubscriber = new WindowBoundaryInnerSubscriber(this); - this.upstream = new AtomicReference(); + this.boundarySubscriber = new WindowBoundaryInnerSubscriber<>(this); + this.upstream = new AtomicReference<>(); this.windows = new AtomicInteger(1); - this.queue = new MpscLinkedQueue(); + this.queue = new MpscLinkedQueue<>(); this.errors = new AtomicThrowable(); this.stopWindows = new AtomicBoolean(); this.requested = new AtomicLong(); @@ -240,7 +240,7 @@ void drain() { if (emitted != requested.get()) { emitted++; - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(w); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(w); downstream.onNext(intercept); if (intercept.tryAbandon()) { w.onComplete(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java index d55198010a..f6248b3355 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowBoundarySelector.java @@ -46,7 +46,7 @@ public FlowableWindowBoundarySelector( @Override protected void subscribeActual(Subscriber> s) { - source.subscribe(new WindowBoundaryMainSubscriber( + source.subscribe(new WindowBoundaryMainSubscriber<>( s, open, closingIndicator, bufferSize)); } @@ -85,16 +85,16 @@ static final class WindowBoundaryMainSubscriber WindowBoundaryMainSubscriber(Subscriber> actual, Publisher open, Function> closingIndicator, int bufferSize) { this.downstream = actual; - this.queue = new MpscLinkedQueue(); + this.queue = new MpscLinkedQueue<>(); this.open = open; this.closingIndicator = closingIndicator; this.bufferSize = bufferSize; this.resources = new CompositeDisposable(); - this.windows = new ArrayList>(); + this.windows = new ArrayList<>(); this.windowCount = new AtomicLong(1L); this.downstreamCancelled = new AtomicBoolean(); this.error = new AtomicThrowable(); - this.startSubscriber = new WindowStartSubscriber(this); + this.startSubscriber = new WindowStartSubscriber<>(this); this.requested = new AtomicLong(); } @@ -171,7 +171,7 @@ public void run() { } void open(B startValue) { - queue.offer(new WindowStartItem(startValue)); + queue.offer(new WindowStartItem<>(startValue)); drain(); } @@ -257,7 +257,7 @@ void drain() { windowCount.getAndIncrement(); UnicastProcessor newWindow = UnicastProcessor.create(bufferSize, this); - WindowEndSubscriberIntercept endSubscriber = new WindowEndSubscriberIntercept(this, newWindow); + WindowEndSubscriberIntercept endSubscriber = new WindowEndSubscriberIntercept<>(this, newWindow); downstream.onNext(endSubscriber); @@ -388,7 +388,7 @@ static final class WindowEndSubscriberIntercept extends Flowable WindowEndSubscriberIntercept(WindowBoundaryMainSubscriber parent, UnicastProcessor window) { this.parent = parent; this.window = window; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.once = new AtomicBoolean(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java index 0dfec4e4af..89b49e857a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowTimed.java @@ -55,18 +55,18 @@ public FlowableWindowTimed(Flowable source, protected void subscribeActual(Subscriber> downstream) { if (timespan == timeskip) { if (maxSize == Long.MAX_VALUE) { - source.subscribe(new WindowExactUnboundedSubscriber( + source.subscribe(new WindowExactUnboundedSubscriber<>( downstream, timespan, unit, scheduler, bufferSize)); return; } - source.subscribe(new WindowExactBoundedSubscriber( + source.subscribe(new WindowExactBoundedSubscriber<>( downstream, timespan, unit, scheduler, bufferSize, maxSize, restartTimerOnMaxSize)); return; } - source.subscribe(new WindowSkipSubscriber(downstream, + source.subscribe(new WindowSkipSubscriber<>(downstream, timespan, timeskip, unit, scheduler.createWorker(), bufferSize)); } @@ -99,7 +99,7 @@ abstract static class AbstractWindowSubscriber AbstractWindowSubscriber(Subscriber> downstream, long timespan, TimeUnit unit, int bufferSize) { this.downstream = downstream; - this.queue = new MpscLinkedQueue(); + this.queue = new MpscLinkedQueue<>(); this.timespan = timespan; this.unit = unit; this.bufferSize = bufferSize; @@ -201,7 +201,7 @@ void createFirstWindow() { emitted = 1; - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(window); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); timer.replace(scheduler.schedulePeriodicallyDirect(this, timespan, timespan, unit)); @@ -290,7 +290,7 @@ else if (!isEmpty) { window = UnicastProcessor.create(bufferSize, windowRunnable); this.window = window; - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(window); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); if (intercept.tryAbandon()) { @@ -369,7 +369,7 @@ void createFirstWindow() { windowCount.getAndIncrement(); window = UnicastProcessor.create(bufferSize, this); - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(window); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); Runnable boundaryTask = new WindowBoundaryRunnable(this, 1L); @@ -507,7 +507,7 @@ UnicastProcessor createNewWindow(UnicastProcessor window) { window = UnicastProcessor.create(bufferSize, this); this.window = window; - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(window); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); if (restartTimerOnMaxSize) { @@ -557,7 +557,7 @@ static final class WindowSkipSubscriber super(actual, timespan, unit, bufferSize); this.timeskip = timeskip; this.worker = worker; - this.windows = new LinkedList>(); + this.windows = new LinkedList<>(); } @Override @@ -570,7 +570,7 @@ void createFirstWindow() { UnicastProcessor window = UnicastProcessor.create(bufferSize, this); windows.add(window); - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(window); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); worker.schedule(new WindowBoundaryRunnable(this, false), timespan, unit); @@ -644,7 +644,7 @@ void drain() { UnicastProcessor window = UnicastProcessor.create(bufferSize, this); windows.add(window); - FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept(window); + FlowableWindowSubscribeIntercept intercept = new FlowableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); worker.schedule(new WindowBoundaryRunnable(this, false), timespan, unit); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java index 049befd1f4..81d3544dd0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFrom.java @@ -36,8 +36,8 @@ public FlowableWithLatestFrom(Flowable source, BiFunction s) { - final SerializedSubscriber serial = new SerializedSubscriber(s); - final WithLatestFromSubscriber wlf = new WithLatestFromSubscriber(serial, combiner); + final SerializedSubscriber serial = new SerializedSubscriber<>(s); + final WithLatestFromSubscriber wlf = new WithLatestFromSubscriber<>(serial, combiner); serial.onSubscribe(wlf); @@ -55,11 +55,11 @@ static final class WithLatestFromSubscriber extends AtomicReference final BiFunction combiner; - final AtomicReference upstream = new AtomicReference(); + final AtomicReference upstream = new AtomicReference<>(); final AtomicLong requested = new AtomicLong(); - final AtomicReference other = new AtomicReference(); + final AtomicReference other = new AtomicReference<>(); WithLatestFromSubscriber(Subscriber actual, BiFunction combiner) { this.downstream = actual; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java index 1d1be81e05..be9166a16d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromMany.java @@ -82,11 +82,11 @@ protected void subscribeActual(Subscriber s) { } if (n == 0) { - new FlowableMap(source, new SingletonArrayFunc()).subscribeActual(s); + new FlowableMap<>(source, new SingletonArrayFunc()).subscribeActual(s); return; } - WithLatestFromSubscriber parent = new WithLatestFromSubscriber(s, combiner, n); + WithLatestFromSubscriber parent = new WithLatestFromSubscriber<>(s, combiner, n); s.onSubscribe(parent); parent.subscribe(others, n); @@ -123,8 +123,8 @@ static final class WithLatestFromSubscriber s[i] = new WithLatestInnerSubscriber(this, i); } this.subscribers = s; - this.values = new AtomicReferenceArray(n); - this.upstream = new AtomicReference(); + this.values = new AtomicReferenceArray<>(n); + this.upstream = new AtomicReference<>(); this.requested = new AtomicLong(); this.error = new AtomicThrowable(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java index 27f1f8e2dc..77011a5a2d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZip.java @@ -71,7 +71,7 @@ public void subscribeActual(Subscriber s) { return; } - ZipCoordinator coordinator = new ZipCoordinator(s, zipper, count, bufferSize, delayError); + ZipCoordinator coordinator = new ZipCoordinator<>(s, zipper, count, bufferSize, delayError); s.onSubscribe(coordinator); @@ -108,7 +108,7 @@ static final class ZipCoordinator @SuppressWarnings("unchecked") ZipSubscriber[] a = new ZipSubscriber[n]; for (int i = 0; i < n; i++) { - a[i] = new ZipSubscriber(this, prefetch); + a[i] = new ZipSubscriber<>(this, prefetch); } this.current = new Object[n]; this.subscribers = a; @@ -354,7 +354,7 @@ public void onSubscribe(Subscription s) { } } - queue = new SpscArrayQueue(prefetch); + queue = new SpscArrayQueue<>(prefetch); s.request(prefetch); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java index 64d57a0605..05c1593707 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCache.java @@ -41,13 +41,13 @@ public final class MaybeCache extends Maybe implements MaybeObserver { @SuppressWarnings("unchecked") public MaybeCache(MaybeSource source) { - this.source = new AtomicReference>(source); - this.observers = new AtomicReference[]>(EMPTY); + this.source = new AtomicReference<>(source); + this.observers = new AtomicReference<>(EMPTY); } @Override protected void subscribeActual(MaybeObserver observer) { - CacheDisposable parent = new CacheDisposable(observer, this); + CacheDisposable parent = new CacheDisposable<>(observer, this); observer.onSubscribe(parent); if (add(parent)) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java index bab81330b2..f77a59c364 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArray.java @@ -38,7 +38,7 @@ public MaybeConcatArray(MaybeSource[] sources) { @Override protected void subscribeActual(Subscriber s) { - ConcatMaybeObserver parent = new ConcatMaybeObserver(s, sources); + ConcatMaybeObserver parent = new ConcatMaybeObserver<>(s, sources); s.onSubscribe(parent); parent.drain(); } @@ -68,7 +68,7 @@ static final class ConcatMaybeObserver this.sources = sources; this.requested = new AtomicLong(); this.disposables = new SequentialDisposable(); - this.current = new AtomicReference(NotificationLite.COMPLETE); // as if a previous completed + this.current = new AtomicReference<>(NotificationLite.COMPLETE); // as if a previous completed } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java index a928db62a6..e889adfe1a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatArrayDelayError.java @@ -39,7 +39,7 @@ public MaybeConcatArrayDelayError(MaybeSource[] sources) { @Override protected void subscribeActual(Subscriber s) { - ConcatMaybeObserver parent = new ConcatMaybeObserver(s, sources); + ConcatMaybeObserver parent = new ConcatMaybeObserver<>(s, sources); s.onSubscribe(parent); parent.drain(); } @@ -71,7 +71,7 @@ static final class ConcatMaybeObserver this.sources = sources; this.requested = new AtomicLong(); this.disposables = new SequentialDisposable(); - this.current = new AtomicReference(NotificationLite.COMPLETE); // as if a previous completed + this.current = new AtomicReference<>(NotificationLite.COMPLETE); // as if a previous completed this.errors = new AtomicThrowable(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java index f3abd7ddb8..ee6e87cbe0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatIterable.java @@ -52,7 +52,7 @@ protected void subscribeActual(Subscriber s) { return; } - ConcatMaybeObserver parent = new ConcatMaybeObserver(s, it); + ConcatMaybeObserver parent = new ConcatMaybeObserver<>(s, it); s.onSubscribe(parent); parent.drain(); } @@ -80,7 +80,7 @@ static final class ConcatMaybeObserver this.sources = sources; this.requested = new AtomicLong(); this.disposables = new SequentialDisposable(); - this.current = new AtomicReference(NotificationLite.COMPLETE); // as if a previous completed + this.current = new AtomicReference<>(NotificationLite.COMPLETE); // as if a previous completed } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java index 2fc0f48414..24293b895b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCreate.java @@ -39,7 +39,7 @@ public MaybeCreate(MaybeOnSubscribe source) { @Override protected void subscribeActual(MaybeObserver observer) { - Emitter parent = new Emitter(observer); + Emitter parent = new Emitter<>(observer); observer.onSubscribe(parent); try { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java index 8509d90ab4..6885763cbd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelay.java @@ -42,7 +42,7 @@ public MaybeDelay(MaybeSource source, long delay, TimeUnit unit, Scheduler sc @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new DelayMaybeObserver(observer, delay, unit, scheduler)); + source.subscribe(new DelayMaybeObserver<>(observer, delay, unit, scheduler)); } static final class DelayMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java index 0e3e8758fe..7797a968a5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayOtherPublisher.java @@ -40,7 +40,7 @@ public MaybeDelayOtherPublisher(MaybeSource source, Publisher other) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new DelayMaybeObserver(observer, other)); + source.subscribe(new DelayMaybeObserver<>(observer, other)); } static final class DelayMaybeObserver @@ -52,7 +52,7 @@ static final class DelayMaybeObserver Disposable upstream; DelayMaybeObserver(MaybeObserver actual, Publisher otherSource) { - this.other = new OtherSubscriber(actual); + this.other = new OtherSubscriber<>(actual); this.otherSource = otherSource; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java index 09851e4af8..7de18c70a5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java @@ -40,7 +40,7 @@ public MaybeDelaySubscriptionOtherPublisher(MaybeSource source, Publisher @Override protected void subscribeActual(MaybeObserver observer) { - other.subscribe(new OtherSubscriber(observer, source)); + other.subscribe(new OtherSubscriber<>(observer, source)); } static final class OtherSubscriber implements FlowableSubscriber, Disposable { @@ -51,7 +51,7 @@ static final class OtherSubscriber implements FlowableSubscriber, Dis Subscription upstream; OtherSubscriber(MaybeObserver actual, MaybeSource source) { - this.main = new DelayMaybeObserver(actual); + this.main = new DelayMaybeObserver<>(actual); this.source = source; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java index 65a9460ec0..6bdc5d1a98 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDelayWithCompletable.java @@ -32,7 +32,7 @@ public MaybeDelayWithCompletable(MaybeSource source, CompletableSource other) @Override protected void subscribeActual(MaybeObserver observer) { - other.subscribe(new OtherObserver(observer, source)); + other.subscribe(new OtherObserver<>(observer, source)); } static final class OtherObserver @@ -64,7 +64,7 @@ public void onError(Throwable e) { @Override public void onComplete() { - source.subscribe(new DelayWithMainObserver(this, downstream)); + source.subscribe(new DelayWithMainObserver<>(this, downstream)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java index 9c4e4b9070..595c362917 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDetach.java @@ -30,7 +30,7 @@ public MaybeDetach(MaybeSource source) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new DetachMaybeObserver(observer)); + source.subscribe(new DetachMaybeObserver<>(observer)); } static final class DetachMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java index 939f817ac9..28943223f0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoAfterSuccess.java @@ -37,7 +37,7 @@ public MaybeDoAfterSuccess(MaybeSource source, Consumer onAfterSuc @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new DoAfterObserver(observer, onAfterSuccess)); + source.subscribe(new DoAfterObserver<>(observer, onAfterSuccess)); } static final class DoAfterObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java index eaeae0234f..0078cf88b1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoFinally.java @@ -39,7 +39,7 @@ public MaybeDoFinally(MaybeSource source, Action onFinally) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new DoFinallyObserver(observer, onFinally)); + source.subscribe(new DoFinallyObserver<>(observer, onFinally)); } static final class DoFinallyObserver extends AtomicInteger implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java index c70397473b..eccc36c606 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEvent.java @@ -36,7 +36,7 @@ public MaybeDoOnEvent(MaybeSource source, BiConsumer observer) { - source.subscribe(new DoOnEventMaybeObserver(observer, onEvent)); + source.subscribe(new DoOnEventMaybeObserver<>(observer, onEvent)); } static final class DoOnEventMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java index e1e7e9fcbf..ddcfc7b3c5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeEqualSingle.java @@ -44,7 +44,7 @@ public MaybeEqualSingle(MaybeSource source1, MaybeSource observer) { - EqualCoordinator parent = new EqualCoordinator(observer, isEqual); + EqualCoordinator parent = new EqualCoordinator<>(observer, isEqual); observer.onSubscribe(parent); parent.subscribe(source1, source2); } @@ -65,8 +65,8 @@ static final class EqualCoordinator super(2); this.downstream = actual; this.isEqual = isEqual; - this.observer1 = new EqualObserver(this); - this.observer2 = new EqualObserver(this); + this.observer1 = new EqualObserver<>(this); + this.observer2 = new EqualObserver<>(this); } void subscribe(MaybeSource source1, MaybeSource source2) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java index a8c4f12176..2ddf5fff27 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilter.java @@ -36,7 +36,7 @@ public MaybeFilter(MaybeSource source, Predicate predicate) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new FilterMaybeObserver(observer, predicate)); + source.subscribe(new FilterMaybeObserver<>(observer, predicate)); } static final class FilterMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java index ff8e71b745..0535447881 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingle.java @@ -37,7 +37,7 @@ public MaybeFilterSingle(SingleSource source, Predicate predicate) @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new FilterMaybeObserver(observer, predicate)); + source.subscribe(new FilterMaybeObserver<>(observer, predicate)); } static final class FilterMaybeObserver implements SingleObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java index afb27373c5..da5cfe56b8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapBiSelector.java @@ -59,7 +59,7 @@ static final class FlatMapBiMainObserver FlatMapBiMainObserver(MaybeObserver actual, Function> mapper, BiFunction resultSelector) { - this.inner = new InnerObserver(actual, resultSelector); + this.inner = new InnerObserver<>(actual, resultSelector); this.mapper = mapper; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java index fb8bb9d9f1..10fc003bf8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapCompletable.java @@ -39,7 +39,7 @@ public MaybeFlatMapCompletable(MaybeSource source, Function parent = new FlatMapCompletableObserver(observer, mapper); + FlatMapCompletableObserver parent = new FlatMapCompletableObserver<>(observer, mapper); observer.onSubscribe(parent); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java index 8460405dc9..40ca98c351 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowable.java @@ -48,7 +48,7 @@ public MaybeFlatMapIterableFlowable(MaybeSource source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new FlatMapIterableObserver(s, mapper)); + source.subscribe(new FlatMapIterableObserver<>(s, mapper)); } static final class FlatMapIterableObserver @@ -279,7 +279,7 @@ public boolean isEmpty() { @Nullable @Override - public R poll() throws Exception { + public R poll() { Iterator iterator = it; if (iterator != null) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java index afbb56f8e9..c5c24995b1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableObservable.java @@ -44,7 +44,7 @@ public MaybeFlatMapIterableObservable(MaybeSource source, @Override protected void subscribeActual(Observer observer) { - source.subscribe(new FlatMapIterableObserver(observer, mapper)); + source.subscribe(new FlatMapIterableObserver<>(observer, mapper)); } static final class FlatMapIterableObserver @@ -189,7 +189,7 @@ public boolean isEmpty() { @Nullable @Override - public R poll() throws Exception { + public R poll() { Iterator iterator = it; if (iterator != null) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java index 2f50f8cd7d..e357938db2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotification.java @@ -48,7 +48,7 @@ public MaybeFlatMapNotification(MaybeSource source, @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new FlatMapMaybeObserver(observer, onSuccessMapper, onErrorMapper, onCompleteSupplier)); + source.subscribe(new FlatMapMaybeObserver<>(observer, onSuccessMapper, onErrorMapper, onCompleteSupplier)); } static final class FlatMapMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java index 38ec9417d9..2199ea470b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingle.java @@ -41,7 +41,7 @@ public MaybeFlatMapSingle(MaybeSource source, Function downstream) { - source.subscribe(new FlatMapMaybeObserver(downstream, mapper)); + source.subscribe(new FlatMapMaybeObserver<>(downstream, mapper)); } static final class FlatMapMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElement.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElement.java index b917a5885e..49b7100575 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElement.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElement.java @@ -42,7 +42,7 @@ public MaybeFlatMapSingleElement(MaybeSource source, Function downstream) { - source.subscribe(new FlatMapMaybeObserver(downstream, mapper)); + source.subscribe(new FlatMapMaybeObserver<>(downstream, mapper)); } static final class FlatMapMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java index 325c4db2ea..21d306095c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatten.java @@ -39,7 +39,7 @@ public MaybeFlatten(MaybeSource source, Function observer) { - source.subscribe(new FlatMapMaybeObserver(observer, mapper)); + source.subscribe(new FlatMapMaybeObserver<>(observer, mapper)); } static final class FlatMapMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java index 2b7b658390..4c83bbeee7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromRunnable.java @@ -58,7 +58,7 @@ protected void subscribeActual(MaybeObserver observer) { } @Override - public T get() throws Throwable { + public T get() { runnable.run(); return null; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java index 7ea38ea986..c74a73ee25 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFromSingle.java @@ -38,7 +38,7 @@ public SingleSource source() { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new FromSingleObserver(observer)); + source.subscribe(new FromSingleObserver<>(observer)); } static final class FromSingleObserver implements SingleObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java index 2950734c37..4dcddd0c27 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeHide.java @@ -30,7 +30,7 @@ public MaybeHide(MaybeSource source) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new HideMaybeObserver(observer)); + source.subscribe(new HideMaybeObserver<>(observer)); } static final class HideMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java index 8750bc4f7e..1c9242548d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElement.java @@ -30,7 +30,7 @@ public MaybeIgnoreElement(MaybeSource source) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new IgnoreMaybeObserver(observer)); + source.subscribe(new IgnoreMaybeObserver<>(observer)); } static final class IgnoreMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java index 4b2ea8d462..6e9c1e9d67 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIgnoreElementCompletable.java @@ -34,12 +34,12 @@ public MaybeIgnoreElementCompletable(MaybeSource source) { @Override protected void subscribeActual(CompletableObserver observer) { - source.subscribe(new IgnoreMaybeObserver(observer)); + source.subscribe(new IgnoreMaybeObserver<>(observer)); } @Override public Maybe fuseToMaybe() { - return RxJavaPlugins.onAssembly(new MaybeIgnoreElement(source)); + return RxJavaPlugins.onAssembly(new MaybeIgnoreElement<>(source)); } static final class IgnoreMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java index 83ec1d278a..64fb3046ba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmpty.java @@ -31,7 +31,7 @@ public MaybeIsEmpty(MaybeSource source) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new IsEmptyMaybeObserver(observer)); + source.subscribe(new IsEmptyMaybeObserver<>(observer)); } static final class IsEmptyMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java index c2f3bf4428..a7fa1882b8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeIsEmptySingle.java @@ -41,12 +41,12 @@ public MaybeSource source() { @Override public Maybe fuseToMaybe() { - return RxJavaPlugins.onAssembly(new MaybeIsEmpty(source)); + return RxJavaPlugins.onAssembly(new MaybeIsEmpty<>(source)); } @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new IsEmptyMaybeObserver(observer)); + source.subscribe(new IsEmptyMaybeObserver<>(observer)); } static final class IsEmptyMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java index 02e6691578..2690bc4797 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMaterialize.java @@ -34,6 +34,6 @@ public MaybeMaterialize(Maybe source) { @Override protected void subscribeActual(SingleObserver> observer) { - source.subscribe(new MaterializeSingleObserver(observer)); + source.subscribe(new MaterializeSingleObserver<>(observer)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java index 2910a2e803..e550b16fba 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeMergeArray.java @@ -47,11 +47,11 @@ protected void subscribeActual(Subscriber s) { SimpleQueueWithConsumerIndex queue; if (n <= bufferSize()) { - queue = new MpscFillOnceSimpleQueue(n); + queue = new MpscFillOnceSimpleQueue<>(n); } else { - queue = new ClqSimpleQueue(); + queue = new ClqSimpleQueue<>(); } - MergeMaybeObserver parent = new MergeMaybeObserver(s, n, queue); + MergeMaybeObserver parent = new MergeMaybeObserver<>(s, n, queue); s.onSubscribe(parent); @@ -110,7 +110,7 @@ public int requestFusion(int mode) { @Nullable @SuppressWarnings("unchecked") @Override - public T poll() throws Exception { + public T poll() { for (;;) { Object o = queue.poll(); if (o != NotificationLite.COMPLETE) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java index 0bf89494e9..7bf03b080e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeObserveOn.java @@ -35,7 +35,7 @@ public MaybeObserveOn(MaybeSource source, Scheduler scheduler) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new ObserveOnMaybeObserver(observer, scheduler)); + source.subscribe(new ObserveOnMaybeObserver<>(observer, scheduler)); } static final class ObserveOnMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java index cd82570f58..8792a93cc5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorComplete.java @@ -37,7 +37,7 @@ public MaybeOnErrorComplete(MaybeSource source, @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new OnErrorCompleteMaybeObserver(observer, predicate)); + source.subscribe(new OnErrorCompleteMaybeObserver<>(observer, predicate)); } static final class OnErrorCompleteMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java index 901016f39a..434685c074 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorNext.java @@ -43,7 +43,7 @@ public MaybeOnErrorNext(MaybeSource source, @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new OnErrorNextMaybeObserver(observer, resumeFunction, allowFatal)); + source.subscribe(new OnErrorNextMaybeObserver<>(observer, resumeFunction, allowFatal)); } static final class OnErrorNextMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java index c7ab7b8524..1a75120e84 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeOnErrorReturn.java @@ -37,7 +37,7 @@ public MaybeOnErrorReturn(MaybeSource source, @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new OnErrorReturnMaybeObserver(observer, valueSupplier)); + source.subscribe(new OnErrorReturnMaybeObserver<>(observer, valueSupplier)); } static final class OnErrorReturnMaybeObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java index 1b4b717367..3b5427ba0f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybePeek.java @@ -53,7 +53,7 @@ public MaybePeek(MaybeSource source, Consumer onSubscribe @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new MaybePeekObserver(observer, this)); + source.subscribe(new MaybePeekObserver<>(observer, this)); } static final class MaybePeekObserver implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java index 8a934d5216..543b7c2b6a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSubscribeOn.java @@ -34,10 +34,10 @@ public MaybeSubscribeOn(MaybeSource source, Scheduler scheduler) { @Override protected void subscribeActual(MaybeObserver observer) { - SubscribeOnMaybeObserver parent = new SubscribeOnMaybeObserver(observer); + SubscribeOnMaybeObserver parent = new SubscribeOnMaybeObserver<>(observer); observer.onSubscribe(parent); - parent.task.replace(scheduler.scheduleDirect(new SubscribeTask(parent, source))); + parent.task.replace(scheduler.scheduleDirect(new SubscribeTask<>(parent, source))); } static final class SubscribeTask implements Runnable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java index e1b218078e..3be260441c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmpty.java @@ -35,7 +35,7 @@ public MaybeSwitchIfEmpty(MaybeSource source, MaybeSource other) @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new SwitchIfEmptyMaybeObserver(observer, other)); + source.subscribe(new SwitchIfEmptyMaybeObserver<>(observer, other)); } static final class SwitchIfEmptyMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java index 3533092a14..142e39f1f6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeSwitchIfEmptySingle.java @@ -42,7 +42,7 @@ public MaybeSource source() { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new SwitchIfEmptyMaybeObserver(observer, other)); + source.subscribe(new SwitchIfEmptyMaybeObserver<>(observer, other)); } static final class SwitchIfEmptyMaybeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java index 9b53acf077..6c9498c065 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilMaybe.java @@ -38,7 +38,7 @@ public MaybeTakeUntilMaybe(MaybeSource source, MaybeSource other) { @Override protected void subscribeActual(MaybeObserver observer) { - TakeUntilMainMaybeObserver parent = new TakeUntilMainMaybeObserver(observer); + TakeUntilMainMaybeObserver parent = new TakeUntilMainMaybeObserver<>(observer); observer.onSubscribe(parent); other.subscribe(parent.other); @@ -57,7 +57,7 @@ static final class TakeUntilMainMaybeObserver TakeUntilMainMaybeObserver(MaybeObserver downstream) { this.downstream = downstream; - this.other = new TakeUntilOtherMaybeObserver(this); + this.other = new TakeUntilOtherMaybeObserver<>(this); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java index 0ef77d40e2..e86cc7c324 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTakeUntilPublisher.java @@ -41,7 +41,7 @@ public MaybeTakeUntilPublisher(MaybeSource source, Publisher other) { @Override protected void subscribeActual(MaybeObserver observer) { - TakeUntilMainMaybeObserver parent = new TakeUntilMainMaybeObserver(observer); + TakeUntilMainMaybeObserver parent = new TakeUntilMainMaybeObserver<>(observer); observer.onSubscribe(parent); other.subscribe(parent.other); @@ -60,7 +60,7 @@ static final class TakeUntilMainMaybeObserver TakeUntilMainMaybeObserver(MaybeObserver downstream) { this.downstream = downstream; - this.other = new TakeUntilOtherMaybeObserver(this); + this.other = new TakeUntilOtherMaybeObserver<>(this); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java index aee0b524c2..03783489a3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutMaybe.java @@ -42,7 +42,7 @@ public MaybeTimeoutMaybe(MaybeSource source, MaybeSource other, MaybeSourc @Override protected void subscribeActual(MaybeObserver observer) { - TimeoutMainMaybeObserver parent = new TimeoutMainMaybeObserver(observer, fallback); + TimeoutMainMaybeObserver parent = new TimeoutMainMaybeObserver<>(observer, fallback); observer.onSubscribe(parent); other.subscribe(parent.other); @@ -66,9 +66,9 @@ static final class TimeoutMainMaybeObserver TimeoutMainMaybeObserver(MaybeObserver actual, MaybeSource fallback) { this.downstream = actual; - this.other = new TimeoutOtherMaybeObserver(this); + this.other = new TimeoutOtherMaybeObserver<>(this); this.fallback = fallback; - this.otherObserver = fallback != null ? new TimeoutFallbackMaybeObserver(actual) : null; + this.otherObserver = fallback != null ? new TimeoutFallbackMaybeObserver<>(actual) : null; } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java index ae1a2efd18..76545730f3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeTimeoutPublisher.java @@ -45,7 +45,7 @@ public MaybeTimeoutPublisher(MaybeSource source, Publisher other, MaybeSou @Override protected void subscribeActual(MaybeObserver observer) { - TimeoutMainMaybeObserver parent = new TimeoutMainMaybeObserver(observer, fallback); + TimeoutMainMaybeObserver parent = new TimeoutMainMaybeObserver<>(observer, fallback); observer.onSubscribe(parent); other.subscribe(parent.other); @@ -69,9 +69,9 @@ static final class TimeoutMainMaybeObserver TimeoutMainMaybeObserver(MaybeObserver actual, MaybeSource fallback) { this.downstream = actual; - this.other = new TimeoutOtherMaybeObserver(this); + this.other = new TimeoutOtherMaybeObserver<>(this); this.fallback = fallback; - this.otherObserver = fallback != null ? new TimeoutFallbackMaybeObserver(actual) : null; + this.otherObserver = fallback != null ? new TimeoutFallbackMaybeObserver<>(actual) : null; } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java index 11b713265d..c31ad262ab 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToFlowable.java @@ -42,7 +42,7 @@ public MaybeSource source() { @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new MaybeToFlowableSubscriber(s)); + source.subscribe(new MaybeToFlowableSubscriber<>(s)); } static final class MaybeToFlowableSubscriber extends DeferredScalarSubscription diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java index 75129b3514..4b27918621 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToObservable.java @@ -52,7 +52,7 @@ protected void subscribeActual(Observer observer) { * @since 2.2 */ public static MaybeObserver create(Observer downstream) { - return new MaybeToObservableObserver(downstream); + return new MaybeToObservableObserver<>(downstream); } static final class MaybeToObservableObserver extends DeferredScalarDisposable diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java index b6552e9726..914021c914 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToPublisher.java @@ -30,7 +30,7 @@ public static Function, Publisher> instance() { } @Override - public Publisher apply(MaybeSource t) throws Exception { - return new MaybeToFlowable(t); + public Publisher apply(MaybeSource t) { + return new MaybeToFlowable<>(t); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java index c620cef68e..3199521639 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToSingle.java @@ -43,7 +43,7 @@ public MaybeSource source() { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new ToSingleMaybeSubscriber(observer, defaultValue)); + source.subscribe(new ToSingleMaybeSubscriber<>(observer, defaultValue)); } static final class ToSingleMaybeSubscriber implements MaybeObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java index 6e29ffa610..2f07161dc9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeUnsubscribeOn.java @@ -35,7 +35,7 @@ public MaybeUnsubscribeOn(MaybeSource source, Scheduler scheduler) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new UnsubscribeOnMaybeObserver(observer, scheduler)); + source.subscribe(new UnsubscribeOnMaybeObserver<>(observer, scheduler)); } static final class UnsubscribeOnMaybeObserver extends AtomicReference diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java index d4bf3b0a77..b155e019fc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipArray.java @@ -40,11 +40,11 @@ protected void subscribeActual(MaybeObserver observer) { int n = sources.length; if (n == 1) { - sources[0].subscribe(new MaybeMap.MapMaybeObserver(observer, new SingletonArrayFunc())); + sources[0].subscribe(new MaybeMap.MapMaybeObserver<>(observer, new SingletonArrayFunc())); return; } - ZipCoordinator parent = new ZipCoordinator(observer, n, zipper); + ZipCoordinator parent = new ZipCoordinator<>(observer, n, zipper); observer.onSubscribe(parent); @@ -82,7 +82,7 @@ static final class ZipCoordinator extends AtomicInteger implements Disposa this.zipper = zipper; ZipMaybeObserver[] o = new ZipMaybeObserver[n]; for (int i = 0; i < n; i++) { - o[i] = new ZipMaybeObserver(this, i); + o[i] = new ZipMaybeObserver<>(this, i); } this.observers = o; this.values = new Object[n]; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java index 7c2d85c97b..839b373920 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeZipIterable.java @@ -62,11 +62,11 @@ protected void subscribeActual(MaybeObserver observer) { } if (n == 1) { - a[0].subscribe(new MaybeMap.MapMaybeObserver(observer, new SingletonArrayFunc())); + a[0].subscribe(new MaybeMap.MapMaybeObserver<>(observer, new SingletonArrayFunc())); return; } - ZipCoordinator parent = new ZipCoordinator(observer, n, zipper); + ZipCoordinator parent = new ZipCoordinator<>(observer, n, zipper); observer.onSubscribe(parent); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java index 28bdae282a..2a3263a50a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/CompletableAndThenObservable.java @@ -40,7 +40,7 @@ public CompletableAndThenObservable(CompletableSource source, @Override protected void subscribeActual(Observer observer) { - AndThenObservableObserver parent = new AndThenObservableObserver(observer, other); + AndThenObservableObserver parent = new AndThenObservableObserver<>(observer, other); observer.onSubscribe(parent); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java index 986af99049..e4a3f36c05 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapCompletable.java @@ -57,7 +57,7 @@ public FlowableConcatMapCompletable(Flowable source, @Override protected void subscribeActual(CompletableObserver observer) { - source.subscribe(new ConcatMapCompletableObserver(observer, mapper, errorMode, prefetch)); + source.subscribe(new ConcatMapCompletableObserver<>(observer, mapper, errorMode, prefetch)); } static final class ConcatMapCompletableObserver @@ -99,7 +99,7 @@ static final class ConcatMapCompletableObserver this.prefetch = prefetch; this.errors = new AtomicThrowable(); this.inner = new ConcatMapInnerObserver(this); - this.queue = new SpscArrayQueue(prefetch); + this.queue = new SpscArrayQueue<>(prefetch); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java index cd8b9fa77f..5f71148e0d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java @@ -58,7 +58,7 @@ public FlowableConcatMapMaybe(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ConcatMapMaybeSubscriber(s, mapper, prefetch, errorMode)); + source.subscribe(new ConcatMapMaybeSubscriber<>(s, mapper, prefetch, errorMode)); } static final class ConcatMapMaybeSubscriber @@ -113,8 +113,8 @@ static final class ConcatMapMaybeSubscriber this.errorMode = errorMode; this.requested = new AtomicLong(); this.errors = new AtomicThrowable(); - this.inner = new ConcatMapMaybeObserver(this); - this.queue = new SpscArrayQueue(prefetch); + this.inner = new ConcatMapMaybeObserver<>(this); + this.queue = new SpscArrayQueue<>(prefetch); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java index 78334d4a1f..f6cd939546 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java @@ -58,7 +58,7 @@ public FlowableConcatMapSingle(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new ConcatMapSingleSubscriber(s, mapper, prefetch, errorMode)); + source.subscribe(new ConcatMapSingleSubscriber<>(s, mapper, prefetch, errorMode)); } static final class ConcatMapSingleSubscriber @@ -113,8 +113,8 @@ static final class ConcatMapSingleSubscriber this.errorMode = errorMode; this.requested = new AtomicLong(); this.errors = new AtomicThrowable(); - this.inner = new ConcatMapSingleObserver(this); - this.queue = new SpscArrayQueue(prefetch); + this.inner = new ConcatMapSingleObserver<>(this); + this.queue = new SpscArrayQueue<>(prefetch); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java index a2d66067ab..1bc0fb709e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletable.java @@ -52,7 +52,7 @@ public FlowableSwitchMapCompletable(Flowable source, @Override protected void subscribeActual(CompletableObserver observer) { - source.subscribe(new SwitchMapCompletableObserver(observer, mapper, delayErrors)); + source.subscribe(new SwitchMapCompletableObserver<>(observer, mapper, delayErrors)); } static final class SwitchMapCompletableObserver implements FlowableSubscriber, Disposable { @@ -79,7 +79,7 @@ static final class SwitchMapCompletableObserver implements FlowableSubscriber this.mapper = mapper; this.delayErrors = delayErrors; this.errors = new AtomicThrowable(); - this.inner = new AtomicReference(); + this.inner = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java index 11ea0a4c77..7933b4ec13 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapMaybe.java @@ -54,7 +54,7 @@ public FlowableSwitchMapMaybe(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SwitchMapMaybeSubscriber(s, mapper, delayErrors)); + source.subscribe(new SwitchMapMaybeSubscriber<>(s, mapper, delayErrors)); } static final class SwitchMapMaybeSubscriber extends AtomicInteger @@ -75,7 +75,7 @@ static final class SwitchMapMaybeSubscriber extends AtomicInteger final AtomicReference> inner; static final SwitchMapMaybeObserver INNER_DISPOSED = - new SwitchMapMaybeObserver(null); + new SwitchMapMaybeObserver<>(null); Subscription upstream; @@ -93,7 +93,7 @@ static final class SwitchMapMaybeSubscriber extends AtomicInteger this.delayErrors = delayErrors; this.errors = new AtomicThrowable(); this.requested = new AtomicLong(); - this.inner = new AtomicReference>(); + this.inner = new AtomicReference<>(); } @Override @@ -125,7 +125,7 @@ public void onNext(T t) { return; } - SwitchMapMaybeObserver observer = new SwitchMapMaybeObserver(this); + SwitchMapMaybeObserver observer = new SwitchMapMaybeObserver<>(this); for (;;) { current = inner.get(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java index c41b52f6e5..4fe83126e5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapSingle.java @@ -54,7 +54,7 @@ public FlowableSwitchMapSingle(Flowable source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new SwitchMapSingleSubscriber(s, mapper, delayErrors)); + source.subscribe(new SwitchMapSingleSubscriber<>(s, mapper, delayErrors)); } static final class SwitchMapSingleSubscriber extends AtomicInteger @@ -75,7 +75,7 @@ static final class SwitchMapSingleSubscriber extends AtomicInteger final AtomicReference> inner; static final SwitchMapSingleObserver INNER_DISPOSED = - new SwitchMapSingleObserver(null); + new SwitchMapSingleObserver<>(null); Subscription upstream; @@ -93,7 +93,7 @@ static final class SwitchMapSingleSubscriber extends AtomicInteger this.delayErrors = delayErrors; this.errors = new AtomicThrowable(); this.requested = new AtomicLong(); - this.inner = new AtomicReference>(); + this.inner = new AtomicReference<>(); } @Override @@ -125,7 +125,7 @@ public void onNext(T t) { return; } - SwitchMapSingleObserver observer = new SwitchMapSingleObserver(this); + SwitchMapSingleObserver observer = new SwitchMapSingleObserver<>(this); for (;;) { current = inner.get(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java index 551b32d4b1..d9cb5592ac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaterializeSingleObserver.java @@ -45,17 +45,17 @@ public void onSubscribe(Disposable d) { @Override public void onComplete() { - downstream.onSuccess(Notification.createOnComplete()); + downstream.onSuccess(Notification.createOnComplete()); } @Override public void onSuccess(T t) { - downstream.onSuccess(Notification.createOnNext(t)); + downstream.onSuccess(Notification.createOnNext(t)); } @Override public void onError(Throwable e) { - downstream.onSuccess(Notification.createOnError(e)); + downstream.onSuccess(Notification.createOnError(e)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java index 891c2a0f33..ae42405f74 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapObservable.java @@ -44,7 +44,7 @@ public MaybeFlatMapObservable(MaybeSource source, @Override protected void subscribeActual(Observer observer) { - FlatMapObserver parent = new FlatMapObserver(observer, mapper); + FlatMapObserver parent = new FlatMapObserver<>(observer, mapper); observer.onSubscribe(parent); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java index 1ac179bcca..c590755704 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/MaybeFlatMapPublisher.java @@ -47,7 +47,7 @@ public MaybeFlatMapPublisher(MaybeSource source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new FlatMapPublisherSubscriber(s, mapper)); + source.subscribe(new FlatMapPublisherSubscriber<>(s, mapper)); } static final class FlatMapPublisherSubscriber diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java index 44f322e39d..2295f4397e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapCompletable.java @@ -55,7 +55,7 @@ public ObservableConcatMapCompletable(Observable source, @Override protected void subscribeActual(CompletableObserver observer) { if (!ScalarXMapZHelper.tryAsCompletable(source, mapper, observer)) { - source.subscribe(new ConcatMapCompletableObserver(observer, mapper, errorMode, prefetch)); + source.subscribe(new ConcatMapCompletableObserver<>(observer, mapper, errorMode, prefetch)); } } @@ -120,7 +120,7 @@ public void onSubscribe(Disposable d) { return; } } - queue = new SpscLinkedArrayQueue(prefetch); + queue = new SpscLinkedArrayQueue<>(prefetch); downstream.onSubscribe(this); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java index c76b0115cb..1177d5a06e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapMaybe.java @@ -56,7 +56,7 @@ public ObservableConcatMapMaybe(Observable source, @Override protected void subscribeActual(Observer observer) { if (!ScalarXMapZHelper.tryAsMaybe(source, mapper, observer)) { - source.subscribe(new ConcatMapMaybeMainObserver(observer, mapper, prefetch, errorMode)); + source.subscribe(new ConcatMapMaybeMainObserver<>(observer, mapper, prefetch, errorMode)); } } @@ -102,8 +102,8 @@ static final class ConcatMapMaybeMainObserver this.mapper = mapper; this.errorMode = errorMode; this.errors = new AtomicThrowable(); - this.inner = new ConcatMapMaybeObserver(this); - this.queue = new SpscLinkedArrayQueue(prefetch); + this.inner = new ConcatMapMaybeObserver<>(this); + this.queue = new SpscLinkedArrayQueue<>(prefetch); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java index 34d7d04734..5fc6b8a520 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingle.java @@ -56,7 +56,7 @@ public ObservableConcatMapSingle(Observable source, @Override protected void subscribeActual(Observer observer) { if (!ScalarXMapZHelper.tryAsSingle(source, mapper, observer)) { - source.subscribe(new ConcatMapSingleMainObserver(observer, mapper, prefetch, errorMode)); + source.subscribe(new ConcatMapSingleMainObserver<>(observer, mapper, prefetch, errorMode)); } } @@ -102,8 +102,8 @@ static final class ConcatMapSingleMainObserver this.mapper = mapper; this.errorMode = errorMode; this.errors = new AtomicThrowable(); - this.inner = new ConcatMapSingleObserver(this); - this.queue = new SpscLinkedArrayQueue(prefetch); + this.inner = new ConcatMapSingleObserver<>(this); + this.queue = new SpscLinkedArrayQueue<>(prefetch); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java index a7a6a7fd99..bb6ec70f85 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapCompletable.java @@ -50,7 +50,7 @@ public ObservableSwitchMapCompletable(Observable source, @Override protected void subscribeActual(CompletableObserver observer) { if (!ScalarXMapZHelper.tryAsCompletable(source, mapper, observer)) { - source.subscribe(new SwitchMapCompletableObserver(observer, mapper, delayErrors)); + source.subscribe(new SwitchMapCompletableObserver<>(observer, mapper, delayErrors)); } } @@ -78,7 +78,7 @@ static final class SwitchMapCompletableObserver implements Observer, Dispo this.mapper = mapper; this.delayErrors = delayErrors; this.errors = new AtomicThrowable(); - this.inner = new AtomicReference(); + this.inner = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java index bf3c9f43c2..f4c9bf6c0c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapMaybe.java @@ -52,7 +52,7 @@ public ObservableSwitchMapMaybe(Observable source, @Override protected void subscribeActual(Observer observer) { if (!ScalarXMapZHelper.tryAsMaybe(source, mapper, observer)) { - source.subscribe(new SwitchMapMaybeMainObserver(observer, mapper, delayErrors)); + source.subscribe(new SwitchMapMaybeMainObserver<>(observer, mapper, delayErrors)); } } @@ -72,7 +72,7 @@ static final class SwitchMapMaybeMainObserver extends AtomicInteger final AtomicReference> inner; static final SwitchMapMaybeObserver INNER_DISPOSED = - new SwitchMapMaybeObserver(null); + new SwitchMapMaybeObserver<>(null); Disposable upstream; @@ -87,7 +87,7 @@ static final class SwitchMapMaybeMainObserver extends AtomicInteger this.mapper = mapper; this.delayErrors = delayErrors; this.errors = new AtomicThrowable(); - this.inner = new AtomicReference>(); + this.inner = new AtomicReference<>(); } @Override @@ -118,7 +118,7 @@ public void onNext(T t) { return; } - SwitchMapMaybeObserver observer = new SwitchMapMaybeObserver(this); + SwitchMapMaybeObserver observer = new SwitchMapMaybeObserver<>(this); for (;;) { current = inner.get(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java index bc19c88b55..f5db39d5d5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableSwitchMapSingle.java @@ -52,7 +52,7 @@ public ObservableSwitchMapSingle(Observable source, @Override protected void subscribeActual(Observer observer) { if (!ScalarXMapZHelper.tryAsSingle(source, mapper, observer)) { - source.subscribe(new SwitchMapSingleMainObserver(observer, mapper, delayErrors)); + source.subscribe(new SwitchMapSingleMainObserver<>(observer, mapper, delayErrors)); } } @@ -72,7 +72,7 @@ static final class SwitchMapSingleMainObserver extends AtomicInteger final AtomicReference> inner; static final SwitchMapSingleObserver INNER_DISPOSED = - new SwitchMapSingleObserver(null); + new SwitchMapSingleObserver<>(null); Disposable upstream; @@ -87,7 +87,7 @@ static final class SwitchMapSingleMainObserver extends AtomicInteger this.mapper = mapper; this.delayErrors = delayErrors; this.errors = new AtomicThrowable(); - this.inner = new AtomicReference>(); + this.inner = new AtomicReference<>(); } @Override @@ -118,7 +118,7 @@ public void onNext(T t) { return; } - SwitchMapSingleObserver observer = new SwitchMapSingleObserver(this); + SwitchMapSingleObserver observer = new SwitchMapSingleObserver<>(this); for (;;) { current = inner.get(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java index bfb466bac1..c3dd9b59c1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/mixed/SingleFlatMapObservable.java @@ -44,7 +44,7 @@ public SingleFlatMapObservable(SingleSource source, @Override protected void subscribeActual(Observer observer) { - FlatMapObserver parent = new FlatMapObserver(observer, mapper); + FlatMapObserver parent = new FlatMapObserver<>(observer, mapper); observer.onSubscribe(parent); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java index 0ba2da1720..dce3e2bc21 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableIterable.java @@ -35,7 +35,7 @@ public BlockingObservableIterable(ObservableSource source, int buff @Override public Iterator iterator() { - BlockingObservableIterator it = new BlockingObservableIterator(bufferSize); + BlockingObservableIterator it = new BlockingObservableIterator<>(bufferSize); source.subscribe(it); return it; } @@ -56,7 +56,7 @@ static final class BlockingObservableIterator volatile Throwable error; BlockingObservableIterator(int batchSize) { - this.queue = new SpscLinkedArrayQueue(batchSize); + this.queue = new SpscLinkedArrayQueue<>(batchSize); this.lock = new ReentrantLock(); this.condition = lock.newCondition(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java index aaa975dbf7..e431db42a7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableLatest.java @@ -38,7 +38,7 @@ public BlockingObservableLatest(ObservableSource source) { @Override public Iterator iterator() { - BlockingObservableLatestIterator lio = new BlockingObservableLatestIterator(); + BlockingObservableLatestIterator lio = new BlockingObservableLatestIterator<>(); Observable> materialized = Observable.wrap(source).materialize(); @@ -52,7 +52,7 @@ static final class BlockingObservableLatestIterator extends DisposableObserve final Semaphore notify = new Semaphore(0); // observer's notification - final AtomicReference> value = new AtomicReference>(); + final AtomicReference> value = new AtomicReference<>(); @Override public void onNext(Notification args) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java index 20408d2607..1332351cac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecent.java @@ -40,7 +40,7 @@ public BlockingObservableMostRecent(ObservableSource source, T initialValue) @Override public Iterator iterator() { - MostRecentObserver mostRecentObserver = new MostRecentObserver(initialValue); + MostRecentObserver mostRecentObserver = new MostRecentObserver<>(initialValue); source.subscribe(mostRecentObserver); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java index 1d5cca354b..53aed40999 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNext.java @@ -39,8 +39,8 @@ public BlockingObservableNext(ObservableSource source) { @Override public Iterator iterator() { - NextObserver nextObserver = new NextObserver(); - return new NextIterator(source, nextObserver); + NextObserver nextObserver = new NextObserver<>(); + return new NextIterator<>(source, nextObserver); } // test needs to access the observer.waiting flag @@ -80,7 +80,7 @@ private boolean moveToNext() { started = true; // if not started, start now observer.setWaiting(); - new ObservableMaterialize(items).subscribe(observer); + new ObservableMaterialize<>(items).subscribe(observer); } Notification nextNotification; @@ -130,7 +130,7 @@ public void remove() { } static final class NextObserver extends DisposableObserver> { - private final BlockingQueue> buf = new ArrayBlockingQueue>(1); + private final BlockingQueue> buf = new ArrayBlockingQueue<>(1); final AtomicInteger waiting = new AtomicInteger(); @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java index a28da3650d..3f62b4732c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAll.java @@ -28,7 +28,7 @@ public ObservableAll(ObservableSource source, Predicate predicate) @Override protected void subscribeActual(Observer t) { - source.subscribe(new AllObserver(t, predicate)); + source.subscribe(new AllObserver<>(t, predicate)); } static final class AllObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java index db004ef966..8c167d4c47 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAllSingle.java @@ -31,12 +31,12 @@ public ObservableAllSingle(ObservableSource source, Predicate pred @Override protected void subscribeActual(SingleObserver t) { - source.subscribe(new AllObserver(t, predicate)); + source.subscribe(new AllObserver<>(t, predicate)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableAll(source, predicate)); + return RxJavaPlugins.onAssembly(new ObservableAll<>(source, predicate)); } static final class AllObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java index aa8fae849d..8bc43aa41c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmb.java @@ -68,7 +68,7 @@ public void subscribeActual(Observer observer) { return; } - AmbCoordinator ac = new AmbCoordinator(observer, count); + AmbCoordinator ac = new AmbCoordinator<>(observer, count); ac.subscribe(sources); } @@ -88,7 +88,7 @@ public void subscribe(ObservableSource[] sources) { AmbInnerObserver[] as = observers; int len = as.length; for (int i = 0; i < len; i++) { - as[i] = new AmbInnerObserver(this, i + 1, downstream); + as[i] = new AmbInnerObserver<>(this, i + 1, downstream); } winner.lazySet(0); // release the contents of 'as' downstream.onSubscribe(this); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java index 69d3298d40..bda497f7ed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAny.java @@ -28,7 +28,7 @@ public ObservableAny(ObservableSource source, Predicate predicate) @Override protected void subscribeActual(Observer t) { - source.subscribe(new AnyObserver(t, predicate)); + source.subscribe(new AnyObserver<>(t, predicate)); } static final class AnyObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java index d3c3e495a5..6e263a0d48 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAnySingle.java @@ -32,12 +32,12 @@ public ObservableAnySingle(ObservableSource source, Predicate pred @Override protected void subscribeActual(SingleObserver t) { - source.subscribe(new AnyObserver(t, predicate)); + source.subscribe(new AnyObserver<>(t, predicate)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableAny(source, predicate)); + return RxJavaPlugins.onAssembly(new ObservableAny<>(source, predicate)); } static final class AnyObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java index c02bcfca88..2c88f007e9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBlockingSubscribe.java @@ -41,9 +41,9 @@ private ObservableBlockingSubscribe() { * @param the value type */ public static void subscribe(ObservableSource o, Observer observer) { - final BlockingQueue queue = new LinkedBlockingQueue(); + final BlockingQueue queue = new LinkedBlockingQueue<>(); - BlockingObserver bs = new BlockingObserver(queue); + BlockingObserver bs = new BlockingObserver<>(queue); observer.onSubscribe(bs); o.subscribe(bs); @@ -76,7 +76,7 @@ public static void subscribe(ObservableSource o, Observer void subscribe(ObservableSource o) { BlockingIgnoringReceiver callback = new BlockingIgnoringReceiver(); - LambdaObserver ls = new LambdaObserver(Functions.emptyConsumer(), + LambdaObserver ls = new LambdaObserver<>(Functions.emptyConsumer(), callback, callback, Functions.emptyConsumer()); o.subscribe(ls); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java index bd7f4b1baa..2688212575 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBuffer.java @@ -39,12 +39,12 @@ public ObservableBuffer(ObservableSource source, int count, int skip, Supplie @Override protected void subscribeActual(Observer t) { if (skip == count) { - BufferExactObserver bes = new BufferExactObserver(t, count, bufferSupplier); + BufferExactObserver bes = new BufferExactObserver<>(t, count, bufferSupplier); if (bes.createBuffer()) { source.subscribe(bes); } } else { - source.subscribe(new BufferSkipObserver(t, count, skip, bufferSupplier)); + source.subscribe(new BufferSkipObserver<>(t, count, skip, bufferSupplier)); } } @@ -157,7 +157,7 @@ static final class BufferSkipObserver> this.count = count; this.skip = skip; this.bufferSupplier = bufferSupplier; - this.buffers = new ArrayDeque(); + this.buffers = new ArrayDeque<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java index cef9ef41d8..4b0027f4fe 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferBoundary.java @@ -43,7 +43,7 @@ public ObservableBufferBoundary(ObservableSource source, ObservableSource t) { BufferBoundaryObserver parent = - new BufferBoundaryObserver( + new BufferBoundaryObserver<>( t, bufferOpen, bufferClose, bufferSupplier ); t.onSubscribe(parent); @@ -88,10 +88,10 @@ static final class BufferBoundaryObserver, Op this.bufferSupplier = bufferSupplier; this.bufferOpen = bufferOpen; this.bufferClose = bufferClose; - this.queue = new SpscLinkedArrayQueue(bufferSize()); + this.queue = new SpscLinkedArrayQueue<>(bufferSize()); this.observers = new CompositeDisposable(); - this.upstream = new AtomicReference(); - this.buffers = new LinkedHashMap(); + this.upstream = new AtomicReference<>(); + this.buffers = new LinkedHashMap<>(); this.errors = new AtomicThrowable(); } @@ -99,7 +99,7 @@ static final class BufferBoundaryObserver, Op public void onSubscribe(Disposable d) { if (DisposableHelper.setOnce(this.upstream, d)) { - BufferOpenObserver open = new BufferOpenObserver(this); + BufferOpenObserver open = new BufferOpenObserver<>(this); observers.add(open); bufferOpen.subscribe(open); @@ -190,7 +190,7 @@ void open(Open token) { bufs.put(idx, buf); } - BufferCloseObserver bc = new BufferCloseObserver(this, idx); + BufferCloseObserver bc = new BufferCloseObserver<>(this, idx); observers.add(bc); p.subscribe(bc); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java index 7d76354cf9..849222505e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferExactBoundary.java @@ -39,7 +39,7 @@ public ObservableBufferExactBoundary(ObservableSource source, ObservableSourc @Override protected void subscribeActual(Observer t) { - source.subscribe(new BufferExactBoundaryObserver(new SerializedObserver(t), bufferSupplier, boundary)); + source.subscribe(new BufferExactBoundaryObserver<>(new SerializedObserver<>(t), bufferSupplier, boundary)); } static final class BufferExactBoundaryObserver, B> @@ -56,7 +56,7 @@ static final class BufferExactBoundaryObserver actual, Supplier bufferSupplier, ObservableSource boundary) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.boundary = boundary; } @@ -80,7 +80,7 @@ public void onSubscribe(Disposable d) { buffer = b; - BufferBoundaryObserver bs = new BufferBoundaryObserver(this); + BufferBoundaryObserver bs = new BufferBoundaryObserver<>(this); other = bs; downstream.onSubscribe(this); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java index 3b12c3d0f5..8a7becc241 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableBufferTimed.java @@ -55,16 +55,16 @@ public ObservableBufferTimed(ObservableSource source, long timespan, long tim @Override protected void subscribeActual(Observer t) { if (timespan == timeskip && maxSize == Integer.MAX_VALUE) { - source.subscribe(new BufferExactUnboundedObserver( - new SerializedObserver(t), + source.subscribe(new BufferExactUnboundedObserver<>( + new SerializedObserver<>(t), bufferSupplier, timespan, unit, scheduler)); return; } Scheduler.Worker w = scheduler.createWorker(); if (timespan == timeskip) { - source.subscribe(new BufferExactBoundedObserver( - new SerializedObserver(t), + source.subscribe(new BufferExactBoundedObserver<>( + new SerializedObserver<>(t), bufferSupplier, timespan, unit, maxSize, restartTimerOnMaxSize, w )); @@ -72,8 +72,8 @@ protected void subscribeActual(Observer t) { } // Can't use maxSize because what to do if a buffer is full but its // timespan hasn't been elapsed? - source.subscribe(new BufferSkipBoundedObserver( - new SerializedObserver(t), + source.subscribe(new BufferSkipBoundedObserver<>( + new SerializedObserver<>(t), bufferSupplier, timespan, timeskip, unit, w)); } @@ -89,12 +89,12 @@ static final class BufferExactUnboundedObserver timer = new AtomicReference(); + final AtomicReference timer = new AtomicReference<>(); BufferExactUnboundedObserver( Observer actual, Supplier bufferSupplier, long timespan, TimeUnit unit, Scheduler scheduler) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.timespan = timespan; this.unit = unit; @@ -228,13 +228,13 @@ static final class BufferSkipBoundedObserver> BufferSkipBoundedObserver(Observer actual, Supplier bufferSupplier, long timespan, long timeskip, TimeUnit unit, Worker w) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.timespan = timespan; this.timeskip = timeskip; this.unit = unit; this.w = w; - this.buffers = new LinkedList(); + this.buffers = new LinkedList<>(); } @Override @@ -285,7 +285,7 @@ public void onError(Throwable t) { public void onComplete() { List bs; synchronized (this) { - bs = new ArrayList(buffers); + bs = new ArrayList<>(buffers); buffers.clear(); } @@ -409,7 +409,7 @@ static final class BufferExactBoundedObserver Supplier bufferSupplier, long timespan, TimeUnit unit, int maxSize, boolean restartOnMaxSize, Worker w) { - super(actual, new MpscLinkedQueue()); + super(actual, new MpscLinkedQueue<>()); this.bufferSupplier = bufferSupplier; this.timespan = timespan; this.unit = unit; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java index d03ad2008e..c3e7447e6e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCache.java @@ -95,15 +95,15 @@ public ObservableCache(Observable source, int capacityHint) { super(source); this.capacityHint = capacityHint; this.once = new AtomicBoolean(); - Node n = new Node(capacityHint); + Node n = new Node<>(capacityHint); this.head = n; this.tail = n; - this.observers = new AtomicReference[]>(EMPTY); + this.observers = new AtomicReference<>(EMPTY); } @Override protected void subscribeActual(Observer t) { - CacheDisposable consumer = new CacheDisposable(t, this); + CacheDisposable consumer = new CacheDisposable<>(t, this); t.onSubscribe(consumer); add(consumer); @@ -292,7 +292,7 @@ public void onNext(T t) { int tailOffset = this.tailOffset; // if the current tail node is full, create a fresh node if (tailOffset == capacityHint) { - Node n = new Node(tailOffset); + Node n = new Node<>(tailOffset); n.values[0] = t; this.tailOffset = 1; tail.next = n; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java index 76b03eddb6..6bddb34aac 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollect.java @@ -43,7 +43,7 @@ protected void subscribeActual(Observer t) { return; } - source.subscribe(new CollectObserver(t, u, collector)); + source.subscribe(new CollectObserver<>(t, u, collector)); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java index 07db8d5bf3..82f8923de3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectSingle.java @@ -47,12 +47,12 @@ protected void subscribeActual(SingleObserver t) { return; } - source.subscribe(new CollectObserver(t, u, collector)); + source.subscribe(new CollectObserver<>(t, u, collector)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableCollect(source, initialSupplier, collector)); + return RxJavaPlugins.onAssembly(new ObservableCollect<>(source, initialSupplier, collector)); } static final class CollectObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java index 0cc8e3e45e..34dce80431 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatest.java @@ -66,7 +66,7 @@ public void subscribeActual(Observer observer) { return; } - LatestCoordinator lc = new LatestCoordinator(observer, combiner, count, bufferSize, delayError); + LatestCoordinator lc = new LatestCoordinator<>(observer, combiner, count, bufferSize, delayError); lc.subscribe(sources); } @@ -99,10 +99,10 @@ static final class LatestCoordinator extends AtomicInteger implements Disp this.latest = new Object[count]; CombinerObserver[] as = new CombinerObserver[count]; for (int i = 0; i < count; i++) { - as[i] = new CombinerObserver(this, i); + as[i] = new CombinerObserver<>(this, i); } this.observers = as; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); } public void subscribe(ObservableSource[] sources) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java index b96b1ec8a0..9b03b9fc35 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMap.java @@ -48,10 +48,10 @@ public void subscribeActual(Observer observer) { } if (delayErrors == ErrorMode.IMMEDIATE) { - SerializedObserver serial = new SerializedObserver(observer); - source.subscribe(new SourceObserver(serial, mapper, bufferSize)); + SerializedObserver serial = new SerializedObserver<>(observer); + source.subscribe(new SourceObserver<>(serial, mapper, bufferSize)); } else { - source.subscribe(new ConcatMapDelayErrorObserver(observer, mapper, bufferSize, delayErrors == ErrorMode.END)); + source.subscribe(new ConcatMapDelayErrorObserver<>(observer, mapper, bufferSize, delayErrors == ErrorMode.END)); } } @@ -80,7 +80,7 @@ static final class SourceObserver extends AtomicInteger implements Observe this.downstream = actual; this.mapper = mapper; this.bufferSize = bufferSize; - this.inner = new InnerObserver(actual, this); + this.inner = new InnerObserver<>(actual, this); } @Override @@ -113,7 +113,7 @@ public void onSubscribe(Disposable d) { } } - queue = new SpscLinkedArrayQueue(bufferSize); + queue = new SpscLinkedArrayQueue<>(bufferSize); downstream.onSubscribe(this); } @@ -305,7 +305,7 @@ static final class ConcatMapDelayErrorObserver this.bufferSize = bufferSize; this.tillTheEnd = tillTheEnd; this.errors = new AtomicThrowable(); - this.observer = new DelayErrorInnerObserver(actual, this); + this.observer = new DelayErrorInnerObserver<>(actual, this); } @Override @@ -338,7 +338,7 @@ public void onSubscribe(Disposable d) { } } - queue = new SpscLinkedArrayQueue(bufferSize); + queue = new SpscLinkedArrayQueue<>(bufferSize); downstream.onSubscribe(this); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java index fe2bed8c8c..792940b5e0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapEager.java @@ -50,7 +50,7 @@ public ObservableConcatMapEager(ObservableSource source, @Override protected void subscribeActual(Observer observer) { - source.subscribe(new ConcatMapEagerMainObserver(observer, mapper, maxConcurrency, prefetch, errorMode)); + source.subscribe(new ConcatMapEagerMainObserver<>(observer, mapper, maxConcurrency, prefetch, errorMode)); } static final class ConcatMapEagerMainObserver @@ -96,7 +96,7 @@ static final class ConcatMapEagerMainObserver this.prefetch = prefetch; this.errorMode = errorMode; this.errors = new AtomicThrowable(); - this.observers = new ArrayDeque>(); + this.observers = new ArrayDeque<>(); } @SuppressWarnings("unchecked") @@ -129,7 +129,7 @@ public void onSubscribe(Disposable d) { } } - queue = new SpscLinkedArrayQueue(prefetch); + queue = new SpscLinkedArrayQueue<>(prefetch); downstream.onSubscribe(this); } @@ -282,7 +282,7 @@ public void drain() { return; } - InnerQueuedObserver inner = new InnerQueuedObserver(this, prefetch); + InnerQueuedObserver inner = new InnerQueuedObserver<>(this, prefetch); observers.offer(inner); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java index f45dd92f1f..b4cd8352b5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatMapScheduler.java @@ -48,10 +48,10 @@ public ObservableConcatMapScheduler(ObservableSource source, Function observer) { if (delayErrors == ErrorMode.IMMEDIATE) { - SerializedObserver serial = new SerializedObserver(observer); - source.subscribe(new ConcatMapObserver(serial, mapper, bufferSize, scheduler.createWorker())); + SerializedObserver serial = new SerializedObserver<>(observer); + source.subscribe(new ConcatMapObserver<>(serial, mapper, bufferSize, scheduler.createWorker())); } else { - source.subscribe(new ConcatMapDelayErrorObserver(observer, mapper, bufferSize, delayErrors == ErrorMode.END, scheduler.createWorker())); + source.subscribe(new ConcatMapDelayErrorObserver<>(observer, mapper, bufferSize, delayErrors == ErrorMode.END, scheduler.createWorker())); } } @@ -81,7 +81,7 @@ static final class ConcatMapObserver extends AtomicInteger implements Obse this.downstream = actual; this.mapper = mapper; this.bufferSize = bufferSize; - this.inner = new InnerObserver(actual, this); + this.inner = new InnerObserver<>(actual, this); this.worker = worker; } @@ -115,7 +115,7 @@ public void onSubscribe(Disposable d) { } } - queue = new SpscLinkedArrayQueue(bufferSize); + queue = new SpscLinkedArrayQueue<>(bufferSize); downstream.onSubscribe(this); } @@ -318,7 +318,7 @@ static final class ConcatMapDelayErrorObserver this.bufferSize = bufferSize; this.tillTheEnd = tillTheEnd; this.errors = new AtomicThrowable(); - this.observer = new DelayErrorInnerObserver(actual, this); + this.observer = new DelayErrorInnerObserver<>(actual, this); this.worker = worker; } @@ -352,7 +352,7 @@ public void onSubscribe(Disposable d) { } } - queue = new SpscLinkedArrayQueue(bufferSize); + queue = new SpscLinkedArrayQueue<>(bufferSize); downstream.onSubscribe(this); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java index 333428a80b..4ffc8f5490 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithCompletable.java @@ -37,7 +37,7 @@ public ObservableConcatWithCompletable(Observable source, CompletableSource o @Override protected void subscribeActual(Observer observer) { - source.subscribe(new ConcatWithObserver(observer, other)); + source.subscribe(new ConcatWithObserver<>(observer, other)); } static final class ConcatWithObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java index 7f3d8d8716..19af4e5641 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java @@ -37,7 +37,7 @@ public ObservableConcatWithMaybe(Observable source, MaybeSource @Override protected void subscribeActual(Observer observer) { - source.subscribe(new ConcatWithObserver(observer, other)); + source.subscribe(new ConcatWithObserver<>(observer, other)); } static final class ConcatWithObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java index 3c91beb30f..b2e1860110 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithSingle.java @@ -37,7 +37,7 @@ public ObservableConcatWithSingle(Observable source, SingleSource observer) { - source.subscribe(new ConcatWithObserver(observer, other)); + source.subscribe(new ConcatWithObserver<>(observer, other)); } static final class ConcatWithObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java index 84042bfbea..5796519f74 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCountSingle.java @@ -32,7 +32,7 @@ public void subscribeActual(SingleObserver t) { @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableCount(source)); + return RxJavaPlugins.onAssembly(new ObservableCount<>(source)); } static final class CountObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java index fe1f394ff3..66445bc8d1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreate.java @@ -33,7 +33,7 @@ public ObservableCreate(ObservableOnSubscribe source) { @Override protected void subscribeActual(Observer observer) { - CreateEmitter parent = new CreateEmitter(observer); + CreateEmitter parent = new CreateEmitter<>(observer); observer.onSubscribe(parent); try { @@ -113,7 +113,7 @@ public void setCancellable(Cancellable c) { @Override public ObservableEmitter serialize() { - return new SerializedEmitter(this); + return new SerializedEmitter<>(this); } @Override @@ -154,7 +154,7 @@ static final class SerializedEmitter SerializedEmitter(ObservableEmitter emitter) { this.emitter = emitter; this.errors = new AtomicThrowable(); - this.queue = new SpscLinkedArrayQueue(16); + this.queue = new SpscLinkedArrayQueue<>(16); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java index 20f98731c1..16f882d6c5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounce.java @@ -34,7 +34,7 @@ public ObservableDebounce(ObservableSource source, Function t) { - source.subscribe(new DebounceObserver(new SerializedObserver(t), debounceSelector)); + source.subscribe(new DebounceObserver<>(new SerializedObserver<>(t), debounceSelector)); } static final class DebounceObserver @@ -44,7 +44,7 @@ static final class DebounceObserver Disposable upstream; - final AtomicReference debouncer = new AtomicReference(); + final AtomicReference debouncer = new AtomicReference<>(); volatile long index; @@ -89,7 +89,7 @@ public void onNext(T t) { return; } - DebounceInnerObserver dis = new DebounceInnerObserver(this, idx, t); + DebounceInnerObserver dis = new DebounceInnerObserver<>(this, idx, t); if (debouncer.compareAndSet(d, dis)) { p.subscribe(dis); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java index 626fe77928..b0b19ef0dc 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDebounceTimed.java @@ -37,8 +37,8 @@ public ObservableDebounceTimed(ObservableSource source, long timeout, TimeUni @Override public void subscribeActual(Observer t) { - source.subscribe(new DebounceTimedObserver( - new SerializedObserver(t), + source.subscribe(new DebounceTimedObserver<>( + new SerializedObserver<>(t), timeout, unit, scheduler.createWorker())); } @@ -85,7 +85,7 @@ public void onNext(T t) { d.dispose(); } - DebounceEmitter de = new DebounceEmitter(t, idx, this); + DebounceEmitter de = new DebounceEmitter<>(t, idx, this); timer = de; d = worker.schedule(de, timeout, unit); de.setResource(d); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java index 61e424a3eb..93cbb00389 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDelay.java @@ -42,12 +42,12 @@ public void subscribeActual(Observer t) { if (delayError) { observer = (Observer)t; } else { - observer = new SerializedObserver(t); + observer = new SerializedObserver<>(t); } Scheduler.Worker w = scheduler.createWorker(); - source.subscribe(new DelayObserver(observer, delay, unit, w, delayError)); + source.subscribe(new DelayObserver<>(observer, delay, unit, w, delayError)); } static final class DelayObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java index 45b42e1ecc..37f5fdadd8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDematerialize.java @@ -33,7 +33,7 @@ public ObservableDematerialize(ObservableSource source, Function observer) { - source.subscribe(new DematerializeObserver(observer, selector)); + source.subscribe(new DematerializeObserver<>(observer, selector)); } static final class DematerializeObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java index 7665a6b4f8..763fcdde97 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDetach.java @@ -32,7 +32,7 @@ public ObservableDetach(ObservableSource source) { @Override protected void subscribeActual(Observer observer) { - source.subscribe(new DetachObserver(observer)); + source.subscribe(new DetachObserver<>(observer)); } static final class DetachObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java index aadeafb2b1..cd766ef559 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinct.java @@ -49,7 +49,7 @@ protected void subscribeActual(Observer observer) { return; } - source.subscribe(new DistinctObserver(observer, keySelector, collection)); + source.subscribe(new DistinctObserver<>(observer, keySelector, collection)); } static final class DistinctObserver extends BasicFuseableObserver { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java index a36e92a3c4..f18e47030d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChanged.java @@ -32,7 +32,7 @@ public ObservableDistinctUntilChanged(ObservableSource source, Function observer) { - source.subscribe(new DistinctUntilChangedObserver(observer, keySelector, comparer)); + source.subscribe(new DistinctUntilChangedObserver<>(observer, keySelector, comparer)); } static final class DistinctUntilChangedObserver extends BasicFuseableObserver { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java index 212b84fccc..91051e7562 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoAfterNext.java @@ -35,7 +35,7 @@ public ObservableDoAfterNext(ObservableSource source, Consumer onA @Override protected void subscribeActual(Observer observer) { - source.subscribe(new DoAfterObserver(observer, onAfterNext)); + source.subscribe(new DoAfterObserver<>(observer, onAfterNext)); } static final class DoAfterObserver extends BasicFuseableObserver { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java index e5087d0ee4..8c7ee32d09 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinally.java @@ -40,7 +40,7 @@ public ObservableDoFinally(ObservableSource source, Action onFinally) { @Override protected void subscribeActual(Observer observer) { - source.subscribe(new DoFinallyObserver(observer, onFinally)); + source.subscribe(new DoFinallyObserver<>(observer, onFinally)); } static final class DoFinallyObserver extends BasicIntQueueDisposable implements Observer { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java index bbc34fed83..ff884192fa 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnEach.java @@ -39,7 +39,7 @@ public ObservableDoOnEach(ObservableSource source, Consumer onNext @Override public void subscribeActual(Observer t) { - source.subscribe(new DoOnEachObserver(t, onNext, onError, onComplete, onAfterTerminate)); + source.subscribe(new DoOnEachObserver<>(t, onNext, onError, onComplete, onAfterTerminate)); } static final class DoOnEachObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java index b59cfdca64..835cd886b2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoOnLifecycle.java @@ -30,6 +30,6 @@ public ObservableDoOnLifecycle(Observable upstream, Consumer observer) { - source.subscribe(new DisposableLambdaObserver(observer, onSubscribe, onDispose)); + source.subscribe(new DisposableLambdaObserver<>(observer, onSubscribe, onDispose)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java index 28ff883d03..b8d042a532 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAt.java @@ -34,7 +34,7 @@ public ObservableElementAt(ObservableSource source, long index, T defaultValu @Override public void subscribeActual(Observer t) { - source.subscribe(new ElementAtObserver(t, index, defaultValue, errorOnFewer)); + source.subscribe(new ElementAtObserver<>(t, index, defaultValue, errorOnFewer)); } static final class ElementAtObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java index ad987cccd2..53b1312092 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtMaybe.java @@ -29,12 +29,12 @@ public ObservableElementAtMaybe(ObservableSource source, long index) { @Override public void subscribeActual(MaybeObserver t) { - source.subscribe(new ElementAtObserver(t, index)); + source.subscribe(new ElementAtObserver<>(t, index)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableElementAt(source, index, null, false)); + return RxJavaPlugins.onAssembly(new ObservableElementAt<>(source, index, null, false)); } static final class ElementAtObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java index 397e678265..bb006ca2dd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableElementAtSingle.java @@ -34,12 +34,12 @@ public ObservableElementAtSingle(ObservableSource source, long index, T defau @Override public void subscribeActual(SingleObserver t) { - source.subscribe(new ElementAtObserver(t, index, defaultValue)); + source.subscribe(new ElementAtObserver<>(t, index, defaultValue)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableElementAt(source, index, defaultValue, true)); + return RxJavaPlugins.onAssembly(new ObservableElementAt<>(source, index, defaultValue, true)); } static final class ElementAtObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java index 3bbacc6250..51fec2cc68 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFilter.java @@ -27,7 +27,7 @@ public ObservableFilter(ObservableSource source, Predicate predica @Override public void subscribeActual(Observer observer) { - source.subscribe(new FilterObserver(observer, predicate)); + source.subscribe(new FilterObserver<>(observer, predicate)); } static final class FilterObserver extends BasicFuseableObserver { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java index 7e01d7cbc1..a169627ed3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMap.java @@ -50,7 +50,7 @@ public void subscribeActual(Observer t) { return; } - source.subscribe(new MergeObserver(t, mapper, delayErrors, maxConcurrency, bufferSize)); + source.subscribe(new MergeObserver<>(t, mapper, delayErrors, maxConcurrency, bufferSize)); } static final class MergeObserver extends AtomicInteger implements Disposable, Observer { @@ -95,9 +95,9 @@ static final class MergeObserver extends AtomicInteger implements Disposab this.maxConcurrency = maxConcurrency; this.bufferSize = bufferSize; if (maxConcurrency != Integer.MAX_VALUE) { - sources = new ArrayDeque>(maxConcurrency); + sources = new ArrayDeque<>(maxConcurrency); } - this.observers = new AtomicReference[]>(EMPTY); + this.observers = new AtomicReference<>(EMPTY); } @Override @@ -158,7 +158,7 @@ void subscribeInner(ObservableSource p) { break; } } else { - InnerObserver inner = new InnerObserver(this, uniqueId++); + InnerObserver inner = new InnerObserver<>(this, uniqueId++); if (addInner(inner)) { p.subscribe(inner); } @@ -239,9 +239,9 @@ boolean tryEmitScalar(Supplier value) { SimplePlainQueue q = queue; if (q == null) { if (maxConcurrency == Integer.MAX_VALUE) { - q = new SpscLinkedArrayQueue(bufferSize); + q = new SpscLinkedArrayQueue<>(bufferSize); } else { - q = new SpscArrayQueue(maxConcurrency); + q = new SpscArrayQueue<>(maxConcurrency); } queue = q; } @@ -267,7 +267,7 @@ void tryEmit(U value, InnerObserver inner) { } else { SimpleQueue q = inner.queue; if (q == null) { - q = new SpscLinkedArrayQueue(bufferSize); + q = new SpscLinkedArrayQueue<>(bufferSize); inner.queue = q; } q.offer(value); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java index 75fc80ac61..729e8cf6c5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletable.java @@ -44,7 +44,7 @@ public ObservableFlatMapCompletable(ObservableSource source, @Override protected void subscribeActual(Observer observer) { - source.subscribe(new FlatMapCompletableMainObserver(observer, mapper, delayErrors)); + source.subscribe(new FlatMapCompletableMainObserver<>(observer, mapper, delayErrors)); } static final class FlatMapCompletableMainObserver extends BasicIntQueueDisposable @@ -145,7 +145,7 @@ public boolean isDisposed() { @Nullable @Override - public T poll() throws Exception { + public T poll() { return null; // always empty } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java index ddf9602a05..2d488ac2c5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapCompletableCompletable.java @@ -46,12 +46,12 @@ public ObservableFlatMapCompletableCompletable(ObservableSource source, @Override protected void subscribeActual(CompletableObserver observer) { - source.subscribe(new FlatMapCompletableMainObserver(observer, mapper, delayErrors)); + source.subscribe(new FlatMapCompletableMainObserver<>(observer, mapper, delayErrors)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableFlatMapCompletable(source, mapper, delayErrors)); + return RxJavaPlugins.onAssembly(new ObservableFlatMapCompletable<>(source, mapper, delayErrors)); } static final class FlatMapCompletableMainObserver extends AtomicInteger implements Disposable, Observer { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java index ac951a571c..7ac5ca6f3c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapMaybe.java @@ -44,7 +44,7 @@ public ObservableFlatMapMaybe(ObservableSource source, Function observer) { - source.subscribe(new FlatMapMaybeObserver(observer, mapper, delayErrors)); + source.subscribe(new FlatMapMaybeObserver<>(observer, mapper, delayErrors)); } static final class FlatMapMaybeObserver @@ -79,7 +79,7 @@ static final class FlatMapMaybeObserver this.set = new CompositeDisposable(); this.errors = new AtomicThrowable(); this.active = new AtomicInteger(1); - this.queue = new AtomicReference>(); + this.queue = new AtomicReference<>(); } @Override @@ -177,7 +177,7 @@ SpscLinkedArrayQueue getOrCreateQueue() { if (current != null) { return current; } - current = new SpscLinkedArrayQueue(Observable.bufferSize()); + current = new SpscLinkedArrayQueue<>(Observable.bufferSize()); if (queue.compareAndSet(null, current)) { return current; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java index 6d5dd3da63..8ed45d5f39 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlatMapSingle.java @@ -44,7 +44,7 @@ public ObservableFlatMapSingle(ObservableSource source, Function observer) { - source.subscribe(new FlatMapSingleObserver(observer, mapper, delayErrors)); + source.subscribe(new FlatMapSingleObserver<>(observer, mapper, delayErrors)); } static final class FlatMapSingleObserver @@ -79,7 +79,7 @@ static final class FlatMapSingleObserver this.set = new CompositeDisposable(); this.errors = new AtomicThrowable(); this.active = new AtomicInteger(1); - this.queue = new AtomicReference>(); + this.queue = new AtomicReference<>(); } @Override @@ -177,7 +177,7 @@ SpscLinkedArrayQueue getOrCreateQueue() { if (current != null) { return current; } - current = new SpscLinkedArrayQueue(Observable.bufferSize()); + current = new SpscLinkedArrayQueue<>(Observable.bufferSize()); if (queue.compareAndSet(null, current)) { return current; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java index 3f90f31acd..732eb50dd3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java @@ -41,7 +41,7 @@ public ObservableFlattenIterable(ObservableSource source, @Override protected void subscribeActual(Observer observer) { - source.subscribe(new FlattenIterableObserver(observer, mapper)); + source.subscribe(new FlattenIterableObserver<>(observer, mapper)); } static final class FlattenIterableObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java index fb4beaaf21..97ebfe0d4f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromArray.java @@ -27,7 +27,7 @@ public ObservableFromArray(T[] array) { @Override public void subscribeActual(Observer observer) { - FromArrayDisposable d = new FromArrayDisposable(observer, array); + FromArrayDisposable d = new FromArrayDisposable<>(observer, array); observer.onSubscribe(d); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java index db08487f81..0285b83ff2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromCallable.java @@ -36,7 +36,7 @@ public ObservableFromCallable(Callable callable) { @Override public void subscribeActual(Observer observer) { - DeferredScalarDisposable d = new DeferredScalarDisposable(observer); + DeferredScalarDisposable d = new DeferredScalarDisposable<>(observer); observer.onSubscribe(d); if (d.isDisposed()) { return; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java index aa9e7da0bb..5459429f4d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromFuture.java @@ -33,7 +33,7 @@ public ObservableFromFuture(Future future, long timeout, TimeUnit u @Override public void subscribeActual(Observer observer) { - DeferredScalarDisposable d = new DeferredScalarDisposable(observer); + DeferredScalarDisposable d = new DeferredScalarDisposable<>(observer); observer.onSubscribe(d); if (!d.isDisposed()) { T v; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java index 9edf260931..187d0cecc3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromIterable.java @@ -51,7 +51,7 @@ public void subscribeActual(Observer observer) { return; } - FromIterableDisposable d = new FromIterableDisposable(observer, it); + FromIterableDisposable d = new FromIterableDisposable<>(observer, it); observer.onSubscribe(d); if (!d.fusionMode) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java index 44b6dbdd00..e46cf8fe8f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromSupplier.java @@ -35,7 +35,7 @@ public ObservableFromSupplier(Supplier supplier) { @Override public void subscribeActual(Observer observer) { - DeferredScalarDisposable d = new DeferredScalarDisposable(observer); + DeferredScalarDisposable d = new DeferredScalarDisposable<>(observer); observer.onSubscribe(d); if (d.isDisposed()) { return; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java index df94a37dbd..2bd9a866a1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerate.java @@ -45,7 +45,7 @@ public void subscribeActual(Observer observer) { return; } - GeneratorDisposable gd = new GeneratorDisposable(observer, generator, disposeState, state); + GeneratorDisposable gd = new GeneratorDisposable<>(observer, generator, disposeState, state); observer.onSubscribe(gd); gd.run(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java index 78edf33cea..8e259db47c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupBy.java @@ -44,7 +44,7 @@ public ObservableGroupBy(ObservableSource source, @Override public void subscribeActual(Observer> t) { - source.subscribe(new GroupByObserver(t, keySelector, valueSelector, bufferSize, delayError)); + source.subscribe(new GroupByObserver<>(t, keySelector, valueSelector, bufferSize, delayError)); } public static final class GroupByObserver extends AtomicInteger implements Observer, Disposable { @@ -70,7 +70,7 @@ public GroupByObserver(Observer> actual, Functio this.valueSelector = valueSelector; this.bufferSize = bufferSize; this.delayError = delayError; - this.groups = new ConcurrentHashMap>(); + this.groups = new ConcurrentHashMap<>(); this.lazySet(1); } @@ -139,7 +139,7 @@ public void onNext(T t) { @Override public void onError(Throwable t) { - List> list = new ArrayList>(groups.values()); + List> list = new ArrayList<>(groups.values()); groups.clear(); for (GroupedUnicast e : list) { @@ -151,7 +151,7 @@ public void onError(Throwable t) { @Override public void onComplete() { - List> list = new ArrayList>(groups.values()); + List> list = new ArrayList<>(groups.values()); groups.clear(); for (GroupedUnicast e : list) { @@ -191,8 +191,8 @@ static final class GroupedUnicast extends GroupedObservable { final State state; public static GroupedUnicast createWith(K key, int bufferSize, GroupByObserver parent, boolean delayError) { - State state = new State(bufferSize, parent, key, delayError); - return new GroupedUnicast(key, state); + State state = new State<>(bufferSize, parent, key, delayError); + return new GroupedUnicast<>(key, state); } protected GroupedUnicast(K key, State state) { @@ -232,7 +232,7 @@ static final class State extends AtomicInteger implements Disposable, Obse final AtomicBoolean cancelled = new AtomicBoolean(); - final AtomicReference> actual = new AtomicReference>(); + final AtomicReference> actual = new AtomicReference<>(); final AtomicInteger once = new AtomicInteger(); @@ -242,7 +242,7 @@ static final class State extends AtomicInteger implements Disposable, Obse static final int ABANDONED_HAS_SUBSCRIBER = ABANDONED | HAS_SUBSCRIBER; State(int bufferSize, GroupByObserver parent, K key, boolean delayError) { - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); this.parent = parent; this.key = key; this.delayError = delayError; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java index 7b12579966..3605ee5203 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGroupJoin.java @@ -58,7 +58,7 @@ public ObservableGroupJoin( protected void subscribeActual(Observer observer) { GroupJoinDisposable parent = - new GroupJoinDisposable(observer, leftEnd, rightEnd, resultSelector); + new GroupJoinDisposable<>(observer, leftEnd, rightEnd, resultSelector); observer.onSubscribe(parent); @@ -130,10 +130,10 @@ static final class GroupJoinDisposable BiFunction, ? extends R> resultSelector) { this.downstream = actual; this.disposables = new CompositeDisposable(); - this.queue = new SpscLinkedArrayQueue(bufferSize()); - this.lefts = new LinkedHashMap>(); - this.rights = new LinkedHashMap(); - this.error = new AtomicReference(); + this.queue = new SpscLinkedArrayQueue<>(bufferSize()); + this.lefts = new LinkedHashMap<>(); + this.rights = new LinkedHashMap<>(); + this.error = new AtomicReference<>(); this.leftEnd = leftEnd; this.rightEnd = rightEnd; this.resultSelector = resultSelector; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java index b929da4f78..5b216cd44c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableHide.java @@ -31,7 +31,7 @@ public ObservableHide(ObservableSource source) { @Override protected void subscribeActual(Observer o) { - source.subscribe(new HideDisposable(o)); + source.subscribe(new HideDisposable<>(o)); } static final class HideDisposable implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java index a633c80dbb..ec4a07e92a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElements.java @@ -24,7 +24,7 @@ public ObservableIgnoreElements(ObservableSource source) { @Override public void subscribeActual(final Observer t) { - source.subscribe(new IgnoreObservable(t)); + source.subscribe(new IgnoreObservable<>(t)); } static final class IgnoreObservable implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java index f19ea85008..14b3a77684 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableIgnoreElementsCompletable.java @@ -28,12 +28,12 @@ public ObservableIgnoreElementsCompletable(ObservableSource source) { @Override public void subscribeActual(final CompletableObserver t) { - source.subscribe(new IgnoreObservable(t)); + source.subscribe(new IgnoreObservable<>(t)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableIgnoreElements(source)); + return RxJavaPlugins.onAssembly(new ObservableIgnoreElements<>(source)); } static final class IgnoreObservable implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java index fcd5f57fa5..5f9dce646d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelper.java @@ -44,7 +44,7 @@ public S apply(S t1, Emitter t2) throws Throwable { } public static BiFunction, S> simpleGenerator(Consumer> consumer) { - return new SimpleGenerator(consumer); + return new SimpleGenerator<>(consumer); } static final class SimpleBiGenerator implements BiFunction, S> { @@ -62,7 +62,7 @@ public S apply(S t1, Emitter t2) throws Throwable { } public static BiFunction, S> simpleBiGenerator(BiConsumer> consumer) { - return new SimpleBiGenerator(consumer); + return new SimpleBiGenerator<>(consumer); } static final class ItemDelayFunction implements Function> { @@ -75,12 +75,12 @@ static final class ItemDelayFunction implements Function apply(final T v) throws Throwable { ObservableSource o = Objects.requireNonNull(itemDelay.apply(v), "The itemDelay returned a null ObservableSource"); - return new ObservableTake(o, 1).map(Functions.justFunction(v)).defaultIfEmpty(v); + return new ObservableTake<>(o, 1).map(Functions.justFunction(v)).defaultIfEmpty(v); } } public static Function> itemDelay(final Function> itemDelay) { - return new ItemDelayFunction(itemDelay); + return new ItemDelayFunction<>(itemDelay); } static final class ObserverOnNext implements Consumer { @@ -91,7 +91,7 @@ static final class ObserverOnNext implements Consumer { } @Override - public void accept(T v) throws Exception { + public void accept(T v) { observer.onNext(v); } } @@ -104,7 +104,7 @@ static final class ObserverOnError implements Consumer { } @Override - public void accept(Throwable v) throws Exception { + public void accept(Throwable v) { observer.onError(v); } } @@ -117,21 +117,21 @@ static final class ObserverOnComplete implements Action { } @Override - public void run() throws Exception { + public void run() { observer.onComplete(); } } public static Consumer observerOnNext(Observer observer) { - return new ObserverOnNext(observer); + return new ObserverOnNext<>(observer); } public static Consumer observerOnError(Observer observer) { - return new ObserverOnError(observer); + return new ObserverOnError<>(observer); } public static Action observerOnComplete(Observer observer) { - return new ObserverOnComplete(observer); + return new ObserverOnComplete<>(observer); } static final class FlatMapWithCombinerInner implements Function { @@ -163,14 +163,14 @@ static final class FlatMapWithCombinerOuter implements Function apply(final T t) throws Throwable { @SuppressWarnings("unchecked") ObservableSource u = (ObservableSource)Objects.requireNonNull(mapper.apply(t), "The mapper returned a null ObservableSource"); - return new ObservableMap(u, new FlatMapWithCombinerInner(combiner, t)); + return new ObservableMap<>(u, new FlatMapWithCombinerInner(combiner, t)); } } public static Function> flatMapWithCombiner( final Function> mapper, final BiFunction combiner) { - return new FlatMapWithCombinerOuter(combiner, mapper); + return new FlatMapWithCombinerOuter<>(combiner, mapper); } static final class FlatMapIntoIterable implements Function> { @@ -182,36 +182,36 @@ static final class FlatMapIntoIterable implements Function apply(T t) throws Throwable { - return new ObservableFromIterable(Objects.requireNonNull(mapper.apply(t), "The mapper returned a null Iterable")); + return new ObservableFromIterable<>(Objects.requireNonNull(mapper.apply(t), "The mapper returned a null Iterable")); } } public static Function> flatMapIntoIterable(final Function> mapper) { - return new FlatMapIntoIterable(mapper); + return new FlatMapIntoIterable<>(mapper); } enum MapToInt implements Function { INSTANCE; @Override - public Object apply(Object t) throws Exception { + public Object apply(Object t) { return 0; } } public static Supplier> replaySupplier(final Observable parent) { - return new ReplaySupplier(parent); + return new ReplaySupplier<>(parent); } public static Supplier> replaySupplier(final Observable parent, final int bufferSize, boolean eagerTruncate) { - return new BufferedReplaySupplier(parent, bufferSize, eagerTruncate); + return new BufferedReplaySupplier<>(parent, bufferSize, eagerTruncate); } public static Supplier> replaySupplier(final Observable parent, final int bufferSize, final long time, final TimeUnit unit, final Scheduler scheduler, boolean eagerTruncate) { - return new BufferedTimedReplaySupplier(parent, bufferSize, time, unit, scheduler, eagerTruncate); + return new BufferedTimedReplaySupplier<>(parent, bufferSize, time, unit, scheduler, eagerTruncate); } public static Supplier> replaySupplier(final Observable parent, final long time, final TimeUnit unit, final Scheduler scheduler, boolean eagerTruncate) { - return new TimedReplayCallable(parent, time, unit, scheduler, eagerTruncate); + return new TimedReplayCallable<>(parent, time, unit, scheduler, eagerTruncate); } static final class ReplaySupplier implements Supplier> { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java index 6660d342f3..70f62aec03 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJoin.java @@ -56,7 +56,7 @@ public ObservableJoin( protected void subscribeActual(Observer observer) { JoinDisposable parent = - new JoinDisposable( + new JoinDisposable<>( observer, leftEnd, rightEnd, resultSelector); observer.onSubscribe(parent); @@ -115,10 +115,10 @@ static final class JoinDisposable BiFunction resultSelector) { this.downstream = actual; this.disposables = new CompositeDisposable(); - this.queue = new SpscLinkedArrayQueue(bufferSize()); - this.lefts = new LinkedHashMap(); - this.rights = new LinkedHashMap(); - this.error = new AtomicReference(); + this.queue = new SpscLinkedArrayQueue<>(bufferSize()); + this.lefts = new LinkedHashMap<>(); + this.rights = new LinkedHashMap<>(); + this.error = new AtomicReference<>(); this.leftEnd = leftEnd; this.rightEnd = rightEnd; this.resultSelector = resultSelector; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java index 0fe64a5291..d3448d0b41 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableJust.java @@ -30,7 +30,7 @@ public ObservableJust(final T value) { @Override protected void subscribeActual(Observer observer) { - ScalarDisposable sd = new ScalarDisposable(observer, value); + ScalarDisposable sd = new ScalarDisposable<>(observer, value); observer.onSubscribe(sd); sd.run(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java index 79457e0e80..73e26a3972 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastMaybe.java @@ -35,7 +35,7 @@ public ObservableLastMaybe(ObservableSource source) { @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new LastObserver(observer)); + source.subscribe(new LastObserver<>(observer)); } static final class LastObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java index 2ba8f28856..7c5433e105 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableLastSingle.java @@ -40,7 +40,7 @@ public ObservableLastSingle(ObservableSource source, T defaultItem) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new LastObserver(observer, defaultItem)); + source.subscribe(new LastObserver<>(observer, defaultItem)); } static final class LastObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java index 147c21ae37..1622b504d4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMapNotification.java @@ -40,7 +40,7 @@ public ObservableMapNotification( @Override public void subscribeActual(Observer> t) { - source.subscribe(new MapNotificationObserver(t, onNextMapper, onErrorMapper, onCompleteSupplier)); + source.subscribe(new MapNotificationObserver<>(t, onNextMapper, onErrorMapper, onCompleteSupplier)); } static final class MapNotificationObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java index 6041961bcb..e55430c378 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterialize.java @@ -25,7 +25,7 @@ public ObservableMaterialize(ObservableSource source) { @Override public void subscribeActual(Observer> t) { - source.subscribe(new MaterializeObserver(t)); + source.subscribe(new MaterializeObserver<>(t)); } static final class MaterializeObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java index 6d022ebf62..1f086f7175 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithCompletable.java @@ -38,7 +38,7 @@ public ObservableMergeWithCompletable(Observable source, CompletableSource ot @Override protected void subscribeActual(Observer observer) { - MergeWithObserver parent = new MergeWithObserver(observer); + MergeWithObserver parent = new MergeWithObserver<>(observer); observer.onSubscribe(parent); source.subscribe(parent); other.subscribe(parent.otherObserver); @@ -63,7 +63,7 @@ static final class MergeWithObserver extends AtomicInteger MergeWithObserver(Observer downstream) { this.downstream = downstream; - this.mainDisposable = new AtomicReference(); + this.mainDisposable = new AtomicReference<>(); this.otherObserver = new OtherObserver(this); this.errors = new AtomicThrowable(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java index d852bff7dd..f462075a50 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybe.java @@ -40,7 +40,7 @@ public ObservableMergeWithMaybe(Observable source, MaybeSource o @Override protected void subscribeActual(Observer observer) { - MergeWithObserver parent = new MergeWithObserver(observer); + MergeWithObserver parent = new MergeWithObserver<>(observer); observer.onSubscribe(parent); source.subscribe(parent); other.subscribe(parent.otherObserver); @@ -75,8 +75,8 @@ static final class MergeWithObserver extends AtomicInteger MergeWithObserver(Observer downstream) { this.downstream = downstream; - this.mainDisposable = new AtomicReference(); - this.otherObserver = new OtherObserver(this); + this.mainDisposable = new AtomicReference<>(); + this.otherObserver = new OtherObserver<>(this); this.errors = new AtomicThrowable(); } @@ -162,7 +162,7 @@ void otherComplete() { SimplePlainQueue getOrCreateQueue() { SimplePlainQueue q = queue; if (q == null) { - q = new SpscLinkedArrayQueue(bufferSize()); + q = new SpscLinkedArrayQueue<>(bufferSize()); queue = q; } return q; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java index 30e80cf4de..08940cf645 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingle.java @@ -40,7 +40,7 @@ public ObservableMergeWithSingle(Observable source, SingleSource @Override protected void subscribeActual(Observer observer) { - MergeWithObserver parent = new MergeWithObserver(observer); + MergeWithObserver parent = new MergeWithObserver<>(observer); observer.onSubscribe(parent); source.subscribe(parent); other.subscribe(parent.otherObserver); @@ -75,8 +75,8 @@ static final class MergeWithObserver extends AtomicInteger MergeWithObserver(Observer downstream) { this.downstream = downstream; - this.mainDisposable = new AtomicReference(); - this.otherObserver = new OtherObserver(this); + this.mainDisposable = new AtomicReference<>(); + this.otherObserver = new OtherObserver<>(this); this.errors = new AtomicThrowable(); } @@ -157,7 +157,7 @@ void otherError(Throwable ex) { SimplePlainQueue getOrCreateQueue() { SimplePlainQueue q = queue; if (q == null) { - q = new SpscLinkedArrayQueue(bufferSize()); + q = new SpscLinkedArrayQueue<>(bufferSize()); queue = q; } return q; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java index 9bc2b39117..af5e78df3f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableObserveOn.java @@ -42,7 +42,7 @@ protected void subscribeActual(Observer observer) { } else { Scheduler.Worker w = scheduler.createWorker(); - source.subscribe(new ObserveOnObserver(observer, w, delayError, bufferSize)); + source.subscribe(new ObserveOnObserver<>(observer, w, delayError, bufferSize)); } } @@ -101,7 +101,7 @@ public void onSubscribe(Disposable d) { } } - queue = new SpscLinkedArrayQueue(bufferSize); + queue = new SpscLinkedArrayQueue<>(bufferSize); downstream.onSubscribe(this); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java index 093e8d1299..3cf1849011 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorNext.java @@ -31,7 +31,7 @@ public ObservableOnErrorNext(ObservableSource source, @Override public void subscribeActual(Observer t) { - OnErrorNextObserver parent = new OnErrorNextObserver(t, nextSupplier); + OnErrorNextObserver parent = new OnErrorNextObserver<>(t, nextSupplier); t.onSubscribe(parent.arbiter); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java index df868ab410..54efdc62e5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableOnErrorReturn.java @@ -28,7 +28,7 @@ public ObservableOnErrorReturn(ObservableSource source, Function t) { - source.subscribe(new OnErrorReturnObserver(t, valueSupplier)); + source.subscribe(new OnErrorReturnObserver<>(t, valueSupplier)); } static final class OnErrorReturnObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java index 629945369e..8589ee3c8a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublish.java @@ -46,7 +46,7 @@ public final class ObservablePublish extends ConnectableObservable public ObservablePublish(ObservableSource source) { this.source = source; - this.current = new AtomicReference>(); + this.current = new AtomicReference<>(); } @Override @@ -58,7 +58,7 @@ public void connect(Consumer connection) { conn = current.get(); if (conn == null || conn.isDisposed()) { - PublishConnection fresh = new PublishConnection(current); + PublishConnection fresh = new PublishConnection<>(current); if (!current.compareAndSet(conn, fresh)) { continue; } @@ -89,7 +89,7 @@ protected void subscribeActual(Observer observer) { conn = current.get(); // we don't create a fresh connection if the current is terminated if (conn == null) { - PublishConnection fresh = new PublishConnection(current); + PublishConnection fresh = new PublishConnection<>(current); if (!current.compareAndSet(conn, fresh)) { continue; } @@ -98,7 +98,7 @@ protected void subscribeActual(Observer observer) { break; } - InnerDisposable inner = new InnerDisposable(observer, conn); + InnerDisposable inner = new InnerDisposable<>(observer, conn); observer.onSubscribe(inner); if (conn.add(inner)) { if (inner.isDisposed()) { @@ -152,7 +152,7 @@ static final class PublishConnection PublishConnection(AtomicReference> current) { this.connect = new AtomicBoolean(); this.current = current; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); lazySet(EMPTY); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java index 8247a6abfc..687bee9548 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservablePublishSelector.java @@ -52,14 +52,14 @@ protected void subscribeActual(Observer observer) { return; } - TargetObserver o = new TargetObserver(observer); + TargetObserver o = new TargetObserver<>(observer); target.subscribe(o); - source.subscribe(new SourceObserver(subject, o)); + source.subscribe(new SourceObserver<>(subject, o)); } - static final class SourceObserver implements Observer { + static final class SourceObserver implements Observer { final PublishSubject subject; @@ -91,7 +91,7 @@ public void onComplete() { } } - static final class TargetObserver + static final class TargetObserver extends AtomicReference implements Observer, Disposable { private static final long serialVersionUID = 854110278590336484L; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java index 2b845fec51..56e277dc32 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRange.java @@ -71,7 +71,7 @@ void run() { @Nullable @Override - public Integer poll() throws Exception { + public Integer poll() { long i = index; if (i != end) { index = i + 1; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java index 2a4122ccad..f92decb11e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRangeLong.java @@ -68,7 +68,7 @@ void run() { @Nullable @Override - public Long poll() throws Exception { + public Long poll() { long i = index; if (i != end) { index = i + 1; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java index bab7bbb065..f5421a666e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceMaybe.java @@ -41,7 +41,7 @@ public ObservableReduceMaybe(ObservableSource source, BiFunction red @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new ReduceObserver(observer, reducer)); + source.subscribe(new ReduceObserver<>(observer, reducer)); } static final class ReduceObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java index e6b0d1d0ef..67347debb8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceSeedSingle.java @@ -45,7 +45,7 @@ public ObservableReduceSeedSingle(ObservableSource source, R seed, BiFunction @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new ReduceSeedObserver(observer, reducer, seed)); + source.subscribe(new ReduceSeedObserver<>(observer, reducer, seed)); } static final class ReduceSeedObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java index 956d7bf7c9..1de6cb1e6c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReduceWithSingle.java @@ -53,6 +53,6 @@ protected void subscribeActual(SingleObserver observer) { EmptyDisposable.error(ex, observer); return; } - source.subscribe(new ReduceSeedObserver(observer, reducer, seed)); + source.subscribe(new ReduceSeedObserver<>(observer, reducer, seed)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java index f0b9157204..a806a537c6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRefCount.java @@ -81,7 +81,7 @@ protected void subscribeActual(Observer observer) { } } - source.subscribe(new RefCountObserver(observer, this, conn)); + source.subscribe(new RefCountObserver<>(observer, this, conn)); if (connect) { source.connect(conn); @@ -166,7 +166,7 @@ public void run() { } @Override - public void accept(Disposable t) throws Exception { + public void accept(Disposable t) { DisposableHelper.replace(this, t); synchronized (parent) { if (disconnectedEarly) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java index ad9159137c..2816dac708 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeat.java @@ -31,7 +31,7 @@ public void subscribeActual(Observer observer) { SequentialDisposable sd = new SequentialDisposable(); observer.onSubscribe(sd); - RepeatObserver rs = new RepeatObserver(observer, count != Long.MAX_VALUE ? count - 1 : Long.MAX_VALUE, sd, source); + RepeatObserver rs = new RepeatObserver<>(observer, count != Long.MAX_VALUE ? count - 1 : Long.MAX_VALUE, sd, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java index 60637fe802..51c8b9dd65 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatUntil.java @@ -33,7 +33,7 @@ public void subscribeActual(Observer observer) { SequentialDisposable sd = new SequentialDisposable(); observer.onSubscribe(sd); - RepeatUntilObserver rs = new RepeatUntilObserver(observer, until, sd, source); + RepeatUntilObserver rs = new RepeatUntilObserver<>(observer, until, sd, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java index eff1e248ac..d3fcdf5971 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatWhen.java @@ -52,7 +52,7 @@ protected void subscribeActual(Observer observer) { return; } - RepeatWhenObserver parent = new RepeatWhenObserver(observer, signaller, source); + RepeatWhenObserver parent = new RepeatWhenObserver<>(observer, signaller, source); observer.onSubscribe(parent); other.subscribe(parent.inner); @@ -87,7 +87,7 @@ static final class RepeatWhenObserver extends AtomicInteger implements Observ this.wip = new AtomicInteger(); this.error = new AtomicThrowable(); this.inner = new InnerRepeatObserver(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java index b6a945e8b7..7dabfcc72d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableReplay.java @@ -59,7 +59,7 @@ interface BufferSupplier { public static Observable multicastSelector( final Supplier> connectableFactory, final Function, ? extends ObservableSource> selector) { - return RxJavaPlugins.onAssembly(new MulticastReplay(connectableFactory, selector)); + return RxJavaPlugins.onAssembly(new MulticastReplay<>(connectableFactory, selector)); } /** @@ -86,7 +86,7 @@ public static ConnectableObservable create(ObservableSource source, if (bufferSize == Integer.MAX_VALUE) { return createFrom(source); } - return create(source, new ReplayBufferSupplier(bufferSize, eagerTruncate)); + return create(source, new ReplayBufferSupplier<>(bufferSize, eagerTruncate)); } /** @@ -117,7 +117,7 @@ public static ConnectableObservable create(ObservableSource source, */ public static ConnectableObservable create(ObservableSource source, final long maxAge, final TimeUnit unit, final Scheduler scheduler, final int bufferSize, boolean eagerTruncate) { - return create(source, new ScheduledReplaySupplier(bufferSize, maxAge, unit, scheduler, eagerTruncate)); + return create(source, new ScheduledReplaySupplier<>(bufferSize, maxAge, unit, scheduler, eagerTruncate)); } /** @@ -129,9 +129,9 @@ public static ConnectableObservable create(ObservableSource source, static ConnectableObservable create(ObservableSource source, final BufferSupplier bufferFactory) { // the current connection to source needs to be shared between the operator and its onSubscribe call - final AtomicReference> curr = new AtomicReference>(); - ObservableSource onSubscribe = new ReplaySource(curr, bufferFactory); - return RxJavaPlugins.onAssembly(new ObservableReplay(onSubscribe, source, curr, bufferFactory)); + final AtomicReference> curr = new AtomicReference<>(); + ObservableSource onSubscribe = new ReplaySource<>(curr, bufferFactory); + return RxJavaPlugins.onAssembly(new ObservableReplay<>(onSubscribe, source, curr, bufferFactory)); } private ObservableReplay(ObservableSource onSubscribe, ObservableSource source, @@ -174,7 +174,7 @@ public void connect(Consumer connection) { // create a new subscriber-to-source ReplayBuffer buf = bufferFactory.call(); - ReplayObserver u = new ReplayObserver(buf); + ReplayObserver u = new ReplayObserver<>(buf); // try setting it as the current subscriber-to-source if (!current.compareAndSet(ps, u)) { // did not work, perhaps a new subscriber arrived @@ -243,7 +243,7 @@ static final class ReplayObserver ReplayObserver(ReplayBuffer buffer) { this.buffer = buffer; - this.observers = new AtomicReference(EMPTY); + this.observers = new AtomicReference<>(EMPTY); this.shouldConnect = new AtomicBoolean(); } @@ -829,7 +829,7 @@ static final class SizeAndTimeBoundReplayBuffer extends BoundedReplayBuffer(value, scheduler.now(unit), unit); + return new Timed<>(value, scheduler.now(unit), unit); } @Override @@ -927,7 +927,7 @@ Node getHead() { static final class UnBoundedFactory implements BufferSupplier { @Override public ReplayBuffer call() { - return new UnboundedReplayBuffer(16); + return new UnboundedReplayBuffer<>(16); } } @@ -957,7 +957,7 @@ static final class ReplayBufferSupplier implements BufferSupplier { @Override public ReplayBuffer call() { - return new SizeBoundReplayBuffer(bufferSize, eagerTruncate); + return new SizeBoundReplayBuffer<>(bufferSize, eagerTruncate); } } @@ -979,7 +979,7 @@ static final class ScheduledReplaySupplier implements BufferSupplier { @Override public ReplayBuffer call() { - return new SizeAndTimeBoundReplayBuffer(bufferSize, maxAge, unit, scheduler, eagerTruncate); + return new SizeAndTimeBoundReplayBuffer<>(bufferSize, maxAge, unit, scheduler, eagerTruncate); } } @@ -1004,7 +1004,7 @@ public void subscribe(Observer child) { // create a new subscriber to source ReplayBuffer buf = bufferFactory.call(); - ReplayObserver u = new ReplayObserver(buf); + ReplayObserver u = new ReplayObserver<>(buf); // let's try setting it as the current subscriber-to-source if (!curr.compareAndSet(null, u)) { // didn't work, maybe someone else did it or the current subscriber @@ -1016,7 +1016,7 @@ public void subscribe(Observer child) { } // create the backpressure-managing producer for this child - InnerDisposable inner = new InnerDisposable(r, child); + InnerDisposable inner = new InnerDisposable<>(r, child); // the producer has been registered with the current subscriber-to-source so // at least it will receive the next terminal event // setting the producer will trigger the first request to be considered by @@ -1062,11 +1062,11 @@ protected void subscribeActual(Observer child) { return; } - final ObserverResourceWrapper srw = new ObserverResourceWrapper(child); + final ObserverResourceWrapper srw = new ObserverResourceWrapper<>(child); observable.subscribe(srw); - co.connect(new DisposeConsumer(srw)); + co.connect(new DisposeConsumer<>(srw)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java index 48edbdaa26..56de8606be 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryBiPredicate.java @@ -35,7 +35,7 @@ public void subscribeActual(Observer observer) { SequentialDisposable sa = new SequentialDisposable(); observer.onSubscribe(sa); - RetryBiObserver rs = new RetryBiObserver(observer, predicate, sa, source); + RetryBiObserver rs = new RetryBiObserver<>(observer, predicate, sa, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java index 963e5c8890..9c4d5c748a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryPredicate.java @@ -37,7 +37,7 @@ public void subscribeActual(Observer observer) { SequentialDisposable sa = new SequentialDisposable(); observer.onSubscribe(sa); - RepeatObserver rs = new RepeatObserver(observer, count, predicate, sa, source); + RepeatObserver rs = new RepeatObserver<>(observer, count, predicate, sa, source); rs.subscribeNext(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java index 0eb5fbb5b7..2a3f0b6b07 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRetryWhen.java @@ -52,7 +52,7 @@ protected void subscribeActual(Observer observer) { return; } - RepeatWhenObserver parent = new RepeatWhenObserver(observer, signaller, source); + RepeatWhenObserver parent = new RepeatWhenObserver<>(observer, signaller, source); observer.onSubscribe(parent); other.subscribe(parent.inner); @@ -87,7 +87,7 @@ static final class RepeatWhenObserver extends AtomicInteger implements Observ this.wip = new AtomicInteger(); this.error = new AtomicThrowable(); this.inner = new InnerRepeatObserver(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java index 4a91ff30b8..3f516e8cca 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleTimed.java @@ -38,11 +38,11 @@ public ObservableSampleTimed(ObservableSource source, long period, TimeUnit u @Override public void subscribeActual(Observer t) { - SerializedObserver serial = new SerializedObserver(t); + SerializedObserver serial = new SerializedObserver<>(t); if (emitLast) { - source.subscribe(new SampleTimedEmitLast(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedEmitLast<>(serial, period, unit, scheduler)); } else { - source.subscribe(new SampleTimedNoLast(serial, period, unit, scheduler)); + source.subscribe(new SampleTimedNoLast<>(serial, period, unit, scheduler)); } } @@ -55,7 +55,7 @@ abstract static class SampleTimedObserver extends AtomicReference implemen final TimeUnit unit; final Scheduler scheduler; - final AtomicReference timer = new AtomicReference(); + final AtomicReference timer = new AtomicReference<>(); Disposable upstream; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java index 4c0fccc654..cae3259d12 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java @@ -34,11 +34,11 @@ public ObservableSampleWithObservable(ObservableSource source, ObservableSour @Override public void subscribeActual(Observer t) { - SerializedObserver serial = new SerializedObserver(t); + SerializedObserver serial = new SerializedObserver<>(t); if (emitLast) { - source.subscribe(new SampleMainEmitLast(serial, other)); + source.subscribe(new SampleMainEmitLast<>(serial, other)); } else { - source.subscribe(new SampleMainNoLast(serial, other)); + source.subscribe(new SampleMainNoLast<>(serial, other)); } } @@ -50,7 +50,7 @@ abstract static class SampleMainObserver extends AtomicReference final Observer downstream; final ObservableSource sampler; - final AtomicReference other = new AtomicReference(); + final AtomicReference other = new AtomicReference<>(); Disposable upstream; @@ -65,7 +65,7 @@ public void onSubscribe(Disposable d) { this.upstream = d; downstream.onSubscribe(this); if (other.get() == null) { - sampler.subscribe(new SamplerObserver(this)); + sampler.subscribe(new SamplerObserver<>(this)); } } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java index f4a1bce25b..c62c23c0c5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScalarXMap.java @@ -88,7 +88,7 @@ public static boolean tryScalarXMapSubscribe(ObservableSource source, EmptyDisposable.complete(observer); return true; } - ScalarDisposable sd = new ScalarDisposable(observer, u); + ScalarDisposable sd = new ScalarDisposable<>(observer, u); observer.onSubscribe(sd); sd.run(); } else { @@ -112,7 +112,7 @@ public static boolean tryScalarXMapSubscribe(ObservableSource source, */ public static Observable scalarXMap(T value, Function> mapper) { - return RxJavaPlugins.onAssembly(new ScalarXMapObservable(value, mapper)); + return RxJavaPlugins.onAssembly(new ScalarXMapObservable<>(value, mapper)); } /** @@ -159,7 +159,7 @@ public void subscribeActual(Observer observer) { EmptyDisposable.complete(observer); return; } - ScalarDisposable sd = new ScalarDisposable(observer, u); + ScalarDisposable sd = new ScalarDisposable<>(observer, u); observer.onSubscribe(sd); sd.run(); } else { @@ -205,7 +205,7 @@ public boolean offer(T v1, T v2) { @Nullable @Override - public T poll() throws Exception { + public T poll() { if (get() == FUSED) { lazySet(ON_COMPLETE); return value; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java index 94918b6c39..bd0ba2b12a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScan.java @@ -31,7 +31,7 @@ public ObservableScan(ObservableSource source, BiFunction accumulato @Override public void subscribeActual(Observer t) { - source.subscribe(new ScanObserver(t, accumulator)); + source.subscribe(new ScanObserver<>(t, accumulator)); } static final class ScanObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java index 24e4b580ad..89eb4046f0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableScanSeed.java @@ -43,7 +43,7 @@ public void subscribeActual(Observer t) { return; } - source.subscribe(new ScanSeedObserver(t, accumulator, r)); + source.subscribe(new ScanSeedObserver<>(t, accumulator, r)); } static final class ScanSeedObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java index 1e779db18e..11eb694696 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqual.java @@ -38,7 +38,7 @@ public ObservableSequenceEqual(ObservableSource first, ObservableSo @Override public void subscribeActual(Observer observer) { - EqualCoordinator ec = new EqualCoordinator(observer, bufferSize, first, second, comparer); + EqualCoordinator ec = new EqualCoordinator<>(observer, bufferSize, first, second, comparer); observer.onSubscribe(ec); ec.subscribe(); } @@ -69,8 +69,8 @@ static final class EqualCoordinator extends AtomicInteger implements Disposab @SuppressWarnings("unchecked") EqualObserver[] as = new EqualObserver[2]; this.observers = as; - as[0] = new EqualObserver(this, 0, bufferSize); - as[1] = new EqualObserver(this, 1, bufferSize); + as[0] = new EqualObserver<>(this, 0, bufferSize); + as[1] = new EqualObserver<>(this, 1, bufferSize); this.resources = new ArrayCompositeDisposable(2); } @@ -226,7 +226,7 @@ static final class EqualObserver implements Observer { EqualObserver(EqualCoordinator parent, int index, int bufferSize) { this.parent = parent; this.index = index; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java index 165a8ab64a..9169cb6465 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualSingle.java @@ -40,14 +40,14 @@ public ObservableSequenceEqualSingle(ObservableSource first, Observ @Override public void subscribeActual(SingleObserver observer) { - EqualCoordinator ec = new EqualCoordinator(observer, bufferSize, first, second, comparer); + EqualCoordinator ec = new EqualCoordinator<>(observer, bufferSize, first, second, comparer); observer.onSubscribe(ec); ec.subscribe(); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableSequenceEqual(first, second, comparer, bufferSize)); + return RxJavaPlugins.onAssembly(new ObservableSequenceEqual<>(first, second, comparer, bufferSize)); } static final class EqualCoordinator extends AtomicInteger implements Disposable { @@ -76,8 +76,8 @@ static final class EqualCoordinator extends AtomicInteger implements Disposab @SuppressWarnings("unchecked") EqualObserver[] as = new EqualObserver[2]; this.observers = as; - as[0] = new EqualObserver(this, 0, bufferSize); - as[1] = new EqualObserver(this, 1, bufferSize); + as[0] = new EqualObserver<>(this, 0, bufferSize); + as[1] = new EqualObserver<>(this, 1, bufferSize); this.resources = new ArrayCompositeDisposable(2); } @@ -230,7 +230,7 @@ static final class EqualObserver implements Observer { EqualObserver(EqualCoordinator parent, int index, int bufferSize) { this.parent = parent; this.index = index; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java index 35ce558744..98f757e6f7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSerialized.java @@ -22,6 +22,6 @@ public ObservableSerialized(Observable upstream) { @Override protected void subscribeActual(Observer observer) { - source.subscribe(new SerializedObserver(observer)); + source.subscribe(new SerializedObserver<>(observer)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java index b0bba864b9..83a8569f05 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleMaybe.java @@ -28,7 +28,7 @@ public ObservableSingleMaybe(ObservableSource source) { @Override public void subscribeActual(MaybeObserver t) { - source.subscribe(new SingleElementObserver(t)); + source.subscribe(new SingleElementObserver<>(t)); } static final class SingleElementObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java index f7c8f597e1..de4729f5e5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSingleSingle.java @@ -33,7 +33,7 @@ public ObservableSingleSingle(ObservableSource source, T defaultVal @Override public void subscribeActual(SingleObserver t) { - source.subscribe(new SingleElementObserver(t, defaultValue)); + source.subscribe(new SingleElementObserver<>(t, defaultValue)); } static final class SingleElementObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java index 9812b33663..e0000dc7a5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkip.java @@ -26,7 +26,7 @@ public ObservableSkip(ObservableSource source, long n) { @Override public void subscribeActual(Observer observer) { - source.subscribe(new SkipObserver(observer, n)); + source.subscribe(new SkipObserver<>(observer, n)); } static final class SkipObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java index 7d7ea2383e..3e45e38a79 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLast.java @@ -29,7 +29,7 @@ public ObservableSkipLast(ObservableSource source, int skip) { @Override public void subscribeActual(Observer observer) { - source.subscribe(new SkipLastObserver(observer, skip)); + source.subscribe(new SkipLastObserver<>(observer, skip)); } static final class SkipLastObserver extends ArrayDeque implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java index 41b34b6186..f70620b5c0 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipLastTimed.java @@ -40,7 +40,7 @@ public ObservableSkipLastTimed(ObservableSource source, @Override public void subscribeActual(Observer t) { - source.subscribe(new SkipLastTimedObserver(t, time, unit, scheduler, bufferSize, delayError)); + source.subscribe(new SkipLastTimedObserver<>(t, time, unit, scheduler, bufferSize, delayError)); } static final class SkipLastTimedObserver extends AtomicInteger implements Observer, Disposable { @@ -65,7 +65,7 @@ static final class SkipLastTimedObserver extends AtomicInteger implements Obs this.time = time; this.unit = unit; this.scheduler = scheduler; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); this.delayError = delayError; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java index 9f0377b784..457158200d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipUntil.java @@ -28,13 +28,13 @@ public ObservableSkipUntil(ObservableSource source, ObservableSource other @Override public void subscribeActual(Observer child) { - final SerializedObserver serial = new SerializedObserver(child); + final SerializedObserver serial = new SerializedObserver<>(child); final ArrayCompositeDisposable frc = new ArrayCompositeDisposable(2); serial.onSubscribe(frc); - final SkipUntilObserver sus = new SkipUntilObserver(serial, frc); + final SkipUntilObserver sus = new SkipUntilObserver<>(serial, frc); other.subscribe(new SkipUntil(frc, sus, serial)); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java index 04326b2647..d6dad232b5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipWhile.java @@ -28,7 +28,7 @@ public ObservableSkipWhile(ObservableSource source, Predicate pred @Override public void subscribeActual(Observer observer) { - source.subscribe(new SkipWhileObserver(observer, predicate)); + source.subscribe(new SkipWhileObserver<>(observer, predicate)); } static final class SkipWhileObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java index f1fce38571..8eac3ae04e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSubscribeOn.java @@ -29,7 +29,7 @@ public ObservableSubscribeOn(ObservableSource source, Scheduler scheduler) { @Override public void subscribeActual(final Observer observer) { - final SubscribeOnObserver parent = new SubscribeOnObserver(observer); + final SubscribeOnObserver parent = new SubscribeOnObserver<>(observer); observer.onSubscribe(parent); @@ -45,7 +45,7 @@ static final class SubscribeOnObserver extends AtomicReference im SubscribeOnObserver(Observer downstream) { this.downstream = downstream; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java index 4b41661f1d..b697afc1c9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchIfEmpty.java @@ -26,7 +26,7 @@ public ObservableSwitchIfEmpty(ObservableSource source, ObservableSource t) { - SwitchIfEmptyObserver parent = new SwitchIfEmptyObserver(t, other); + SwitchIfEmptyObserver parent = new SwitchIfEmptyObserver<>(t, other); t.onSubscribe(parent.arbiter); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java index bca0f1beeb..e533834541 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSwitchMap.java @@ -48,7 +48,7 @@ public void subscribeActual(Observer t) { return; } - source.subscribe(new SwitchMapObserver(t, mapper, bufferSize, delayErrors)); + source.subscribe(new SwitchMapObserver<>(t, mapper, bufferSize, delayErrors)); } static final class SwitchMapObserver extends AtomicInteger implements Observer, Disposable { @@ -68,11 +68,11 @@ static final class SwitchMapObserver extends AtomicInteger implements Obse Disposable upstream; - final AtomicReference> active = new AtomicReference>(); + final AtomicReference> active = new AtomicReference<>(); static final SwitchMapInnerObserver CANCELLED; static { - CANCELLED = new SwitchMapInnerObserver(null, -1L, 1); + CANCELLED = new SwitchMapInnerObserver<>(null, -1L, 1); CANCELLED.cancel(); } @@ -116,7 +116,7 @@ public void onNext(T t) { return; } - SwitchMapInnerObserver nextInner = new SwitchMapInnerObserver(this, c, bufferSize); + SwitchMapInnerObserver nextInner = new SwitchMapInnerObserver<>(this, c, bufferSize); for (;;) { inner = active.get(); @@ -364,7 +364,7 @@ public void onSubscribe(Disposable d) { } } - queue = new SpscLinkedArrayQueue(bufferSize); + queue = new SpscLinkedArrayQueue<>(bufferSize); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java index 7e675f061c..63f37db46e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTake.java @@ -27,7 +27,7 @@ public ObservableTake(ObservableSource source, long limit) { @Override protected void subscribeActual(Observer observer) { - source.subscribe(new TakeObserver(observer, limit)); + source.subscribe(new TakeObserver<>(observer, limit)); } static final class TakeObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java index 45566a64e7..bfa2ee0bdd 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLast.java @@ -29,7 +29,7 @@ public ObservableTakeLast(ObservableSource source, int count) { @Override public void subscribeActual(Observer t) { - source.subscribe(new TakeLastObserver(t, count)); + source.subscribe(new TakeLastObserver<>(t, count)); } static final class TakeLastObserver extends ArrayDeque implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java index 8f176bfebd..f2766db765 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastOne.java @@ -24,7 +24,7 @@ public ObservableTakeLastOne(ObservableSource source) { @Override public void subscribeActual(Observer observer) { - source.subscribe(new TakeLastOneObserver(observer)); + source.subscribe(new TakeLastOneObserver<>(observer)); } static final class TakeLastOneObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java index 0b9e16e26f..be6f83db79 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimed.java @@ -42,7 +42,7 @@ public ObservableTakeLastTimed(ObservableSource source, @Override public void subscribeActual(Observer t) { - source.subscribe(new TakeLastTimedObserver(t, count, time, unit, scheduler, bufferSize, delayError)); + source.subscribe(new TakeLastTimedObserver<>(t, count, time, unit, scheduler, bufferSize, delayError)); } static final class TakeLastTimedObserver @@ -69,7 +69,7 @@ static final class TakeLastTimedObserver this.time = time; this.unit = unit; this.scheduler = scheduler; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); this.delayError = delayError; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java index fdb376c57e..f1d5d00a0d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntil.java @@ -31,7 +31,7 @@ public ObservableTakeUntil(ObservableSource source, ObservableSource child) { - TakeUntilMainObserver parent = new TakeUntilMainObserver(child); + TakeUntilMainObserver parent = new TakeUntilMainObserver<>(child); child.onSubscribe(parent); other.subscribe(parent.otherObserver); @@ -53,7 +53,7 @@ static final class TakeUntilMainObserver extends AtomicInteger TakeUntilMainObserver(Observer downstream) { this.downstream = downstream; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.otherObserver = new OtherObserver(); this.error = new AtomicThrowable(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java index d38aabd839..1727a24fb4 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeUntilPredicate.java @@ -29,7 +29,7 @@ public ObservableTakeUntilPredicate(ObservableSource source, Predicate observer) { - source.subscribe(new TakeUntilPredicateObserver(observer, predicate)); + source.subscribe(new TakeUntilPredicateObserver<>(observer, predicate)); } static final class TakeUntilPredicateObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java index 62cb16d791..5c251c969e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeWhile.java @@ -29,7 +29,7 @@ public ObservableTakeWhile(ObservableSource source, Predicate pred @Override public void subscribeActual(Observer t) { - source.subscribe(new TakeWhileObserver(t, predicate)); + source.subscribe(new TakeWhileObserver<>(t, predicate)); } static final class TakeWhileObserver implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java index 5708f04816..041ce80840 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleFirstTimed.java @@ -38,8 +38,8 @@ public ObservableThrottleFirstTimed(ObservableSource source, @Override public void subscribeActual(Observer t) { - source.subscribe(new DebounceTimedObserver( - new SerializedObserver(t), + source.subscribe(new DebounceTimedObserver<>( + new SerializedObserver<>(t), timeout, unit, scheduler.createWorker())); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java index 9d23714549..253f5d3501 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableThrottleLatest.java @@ -53,7 +53,7 @@ public ObservableThrottleLatest(Observable source, @Override protected void subscribeActual(Observer observer) { - source.subscribe(new ThrottleLatestObserver(observer, timeout, unit, scheduler.createWorker(), emitLast)); + source.subscribe(new ThrottleLatestObserver<>(observer, timeout, unit, scheduler.createWorker(), emitLast)); } static final class ThrottleLatestObserver @@ -93,7 +93,7 @@ static final class ThrottleLatestObserver this.unit = unit; this.worker = worker; this.emitLast = emitLast; - this.latest = new AtomicReference(); + this.latest = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java index f5ad5a52f5..7dd47ec03b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeInterval.java @@ -32,7 +32,7 @@ public ObservableTimeInterval(ObservableSource source, TimeUnit unit, Schedul @Override public void subscribeActual(Observer> t) { - source.subscribe(new TimeIntervalObserver(t, unit, scheduler)); + source.subscribe(new TimeIntervalObserver<>(t, unit, scheduler)); } static final class TimeIntervalObserver implements Observer, Disposable { @@ -75,7 +75,7 @@ public void onNext(T t) { long last = lastTime; lastTime = now; long delta = now - last; - downstream.onNext(new Timed(t, delta, unit)); + downstream.onNext(new Timed<>(t, delta, unit)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java index a9ada29730..dfef0e74e6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeout.java @@ -44,12 +44,12 @@ public ObservableTimeout( @Override protected void subscribeActual(Observer observer) { if (other == null) { - TimeoutObserver parent = new TimeoutObserver(observer, itemTimeoutIndicator); + TimeoutObserver parent = new TimeoutObserver<>(observer, itemTimeoutIndicator); observer.onSubscribe(parent); parent.startFirstTimeout(firstTimeoutIndicator); source.subscribe(parent); } else { - TimeoutFallbackObserver parent = new TimeoutFallbackObserver(observer, itemTimeoutIndicator, other); + TimeoutFallbackObserver parent = new TimeoutFallbackObserver<>(observer, itemTimeoutIndicator, other); observer.onSubscribe(parent); parent.startFirstTimeout(firstTimeoutIndicator); source.subscribe(parent); @@ -77,7 +77,7 @@ static final class TimeoutObserver extends AtomicLong this.downstream = actual; this.itemTimeoutIndicator = itemTimeoutIndicator; this.task = new SequentialDisposable(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override @@ -206,7 +206,7 @@ static final class TimeoutFallbackObserver this.task = new SequentialDisposable(); this.fallback = fallback; this.index = new AtomicLong(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java index 0553c9474f..29b1772930 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTimed.java @@ -41,12 +41,12 @@ public ObservableTimeoutTimed(Observable source, @Override protected void subscribeActual(Observer observer) { if (other == null) { - TimeoutObserver parent = new TimeoutObserver(observer, timeout, unit, scheduler.createWorker()); + TimeoutObserver parent = new TimeoutObserver<>(observer, timeout, unit, scheduler.createWorker()); observer.onSubscribe(parent); parent.startTimeout(0L); source.subscribe(parent); } else { - TimeoutFallbackObserver parent = new TimeoutFallbackObserver(observer, timeout, unit, scheduler.createWorker(), other); + TimeoutFallbackObserver parent = new TimeoutFallbackObserver<>(observer, timeout, unit, scheduler.createWorker(), other); observer.onSubscribe(parent); parent.startTimeout(0L); source.subscribe(parent); @@ -76,7 +76,7 @@ static final class TimeoutObserver extends AtomicLong this.unit = unit; this.worker = worker; this.task = new SequentialDisposable(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override @@ -196,7 +196,7 @@ static final class TimeoutFallbackObserver extends AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java index 9cde3b4033..6a3c5322f2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToList.java @@ -49,7 +49,7 @@ public void subscribeActual(Observer t) { EmptyDisposable.error(e, t); return; } - source.subscribe(new ToListObserver(t, coll)); + source.subscribe(new ToListObserver<>(t, coll)); } static final class ToListObserver> implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java index 6258313b61..0ac41b12d6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToListSingle.java @@ -53,12 +53,12 @@ public void subscribeActual(SingleObserver t) { EmptyDisposable.error(e, t); return; } - source.subscribe(new ToListObserver(t, coll)); + source.subscribe(new ToListObserver<>(t, coll)); } @Override public Observable fuseToObservable() { - return RxJavaPlugins.onAssembly(new ObservableToList(source, collectionSupplier)); + return RxJavaPlugins.onAssembly(new ObservableToList<>(source, collectionSupplier)); } static final class ToListObserver> implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java index d012b7cc4d..2c5f748477 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUnsubscribeOn.java @@ -29,7 +29,7 @@ public ObservableUnsubscribeOn(ObservableSource source, Scheduler scheduler) @Override public void subscribeActual(Observer t) { - source.subscribe(new UnsubscribeObserver(t, scheduler)); + source.subscribe(new UnsubscribeObserver<>(t, scheduler)); } static final class UnsubscribeObserver extends AtomicBoolean implements Observer, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java index 60fad9e740..dec3da5ebe 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableUsing.java @@ -67,7 +67,7 @@ public void subscribeActual(Observer observer) { return; } - UsingObserver us = new UsingObserver(observer, resource, disposer, eager); + UsingObserver us = new UsingObserver<>(observer, resource, disposer, eager); source.subscribe(us); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java index 3f11f3952a..3ada9cd93c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindow.java @@ -36,9 +36,9 @@ public ObservableWindow(ObservableSource source, long count, long skip, int c @Override public void subscribeActual(Observer> t) { if (count == skip) { - source.subscribe(new WindowExactObserver(t, count, capacityHint)); + source.subscribe(new WindowExactObserver<>(t, count, capacityHint)); } else { - source.subscribe(new WindowSkipObserver(t, count, skip, capacityHint)); + source.subscribe(new WindowSkipObserver<>(t, count, skip, capacityHint)); } } @@ -81,7 +81,7 @@ public void onNext(T t) { if (w == null && !cancelled) { w = UnicastSubject.create(capacityHint, this); window = w; - intercept = new ObservableWindowSubscribeIntercept(w); + intercept = new ObservableWindowSubscribeIntercept<>(w); downstream.onNext(intercept); } @@ -169,7 +169,7 @@ static final class WindowSkipObserver extends AtomicBoolean this.count = count; this.skip = skip; this.capacityHint = capacityHint; - this.windows = new ArrayDeque>(); + this.windows = new ArrayDeque<>(); } @Override @@ -194,7 +194,7 @@ public void onNext(T t) { if (i % s == 0 && !cancelled) { wip.getAndIncrement(); UnicastSubject w = UnicastSubject.create(capacityHint, this); - intercept = new ObservableWindowSubscribeIntercept(w); + intercept = new ObservableWindowSubscribeIntercept<>(w); ws.offer(w); downstream.onNext(intercept); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java index 48de711a04..503a5cbd29 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundary.java @@ -36,7 +36,7 @@ public ObservableWindowBoundary(ObservableSource source, ObservableSource @Override public void subscribeActual(Observer> observer) { - WindowBoundaryMainObserver parent = new WindowBoundaryMainObserver(observer, capacityHint); + WindowBoundaryMainObserver parent = new WindowBoundaryMainObserver<>(observer, capacityHint); observer.onSubscribe(parent); other.subscribe(parent.boundaryObserver); @@ -75,10 +75,10 @@ static final class WindowBoundaryMainObserver WindowBoundaryMainObserver(Observer> downstream, int capacityHint) { this.downstream = downstream; this.capacityHint = capacityHint; - this.boundaryObserver = new WindowBoundaryInnerObserver(this); - this.upstream = new AtomicReference(); + this.boundaryObserver = new WindowBoundaryInnerObserver<>(this); + this.upstream = new AtomicReference<>(); this.windows = new AtomicInteger(1); - this.queue = new MpscLinkedQueue(); + this.queue = new MpscLinkedQueue<>(); this.errors = new AtomicThrowable(); this.stopWindows = new AtomicBoolean(); } @@ -230,7 +230,7 @@ void drain() { window = w; windows.getAndIncrement(); - ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept(w); + ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept<>(w); downstream.onNext(intercept); if (intercept.tryAbandon()) { w.onComplete(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java index 8722d6df0c..367ddf2d02 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowBoundarySelector.java @@ -46,7 +46,7 @@ public ObservableWindowBoundarySelector( @Override public void subscribeActual(Observer> t) { - source.subscribe(new WindowBoundaryMainObserver( + source.subscribe(new WindowBoundaryMainObserver<>( t, open, closingIndicator, bufferSize)); } @@ -85,16 +85,16 @@ static final class WindowBoundaryMainObserver WindowBoundaryMainObserver(Observer> downstream, ObservableSource open, Function> closingIndicator, int bufferSize) { this.downstream = downstream; - this.queue = new MpscLinkedQueue(); + this.queue = new MpscLinkedQueue<>(); this.open = open; this.closingIndicator = closingIndicator; this.bufferSize = bufferSize; this.resources = new CompositeDisposable(); - this.windows = new ArrayList>(); + this.windows = new ArrayList<>(); this.windowCount = new AtomicLong(1L); this.downstreamDisposed = new AtomicBoolean(); this.error = new AtomicThrowable(); - this.startObserver = new WindowStartObserver(this); + this.startObserver = new WindowStartObserver<>(this); this.requested = new AtomicLong(); } @@ -167,7 +167,7 @@ public void run() { } void open(B startValue) { - queue.offer(new WindowStartItem(startValue)); + queue.offer(new WindowStartItem<>(startValue)); drain(); } @@ -249,7 +249,7 @@ void drain() { windowCount.getAndIncrement(); UnicastSubject newWindow = UnicastSubject.create(bufferSize, this); - WindowEndObserverIntercept endObserver = new WindowEndObserverIntercept(this, newWindow); + WindowEndObserverIntercept endObserver = new WindowEndObserverIntercept<>(this, newWindow); downstream.onNext(endObserver); @@ -371,7 +371,7 @@ static final class WindowEndObserverIntercept extends Observable WindowEndObserverIntercept(WindowBoundaryMainObserver parent, UnicastSubject window) { this.parent = parent; this.window = window; - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.once = new AtomicBoolean(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java index 3913bf2911..5c295f4608 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java @@ -53,18 +53,18 @@ public ObservableWindowTimed(Observable source, protected void subscribeActual(Observer> downstream) { if (timespan == timeskip) { if (maxSize == Long.MAX_VALUE) { - source.subscribe(new WindowExactUnboundedObserver( + source.subscribe(new WindowExactUnboundedObserver<>( downstream, timespan, unit, scheduler, bufferSize)); return; } - source.subscribe(new WindowExactBoundedObserver( + source.subscribe(new WindowExactBoundedObserver<>( downstream, timespan, unit, scheduler, bufferSize, maxSize, restartTimerOnMaxSize)); return; } - source.subscribe(new WindowSkipObserver(downstream, + source.subscribe(new WindowSkipObserver<>(downstream, timespan, timeskip, unit, scheduler.createWorker(), bufferSize)); } @@ -96,7 +96,7 @@ abstract static class AbstractWindowObserver AbstractWindowObserver(Observer> downstream, long timespan, TimeUnit unit, int bufferSize) { this.downstream = downstream; - this.queue = new MpscLinkedQueue(); + this.queue = new MpscLinkedQueue<>(); this.timespan = timespan; this.unit = unit; this.bufferSize = bufferSize; @@ -194,7 +194,7 @@ void createFirstWindow() { emitted = 1; - ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept(window); + ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); timer.replace(scheduler.schedulePeriodicallyDirect(this, timespan, timespan, unit)); @@ -267,7 +267,7 @@ else if (!isEmpty) { window = UnicastSubject.create(bufferSize, windowRunnable); this.window = window; - ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept(window); + ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); if (intercept.tryAbandon()) { @@ -344,7 +344,7 @@ void createFirstWindow() { windowCount.getAndIncrement(); window = UnicastSubject.create(bufferSize, this); - ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept(window); + ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); Runnable boundaryTask = new WindowBoundaryRunnable(this, 1L); @@ -466,7 +466,7 @@ UnicastSubject createNewWindow(UnicastSubject window) { window = UnicastSubject.create(bufferSize, this); this.window = window; - ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept(window); + ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); if (restartTimerOnMaxSize) { @@ -515,7 +515,7 @@ static final class WindowSkipObserver super(actual, timespan, unit, bufferSize); this.timeskip = timeskip; this.worker = worker; - this.windows = new LinkedList>(); + this.windows = new LinkedList<>(); } @Override @@ -527,7 +527,7 @@ void createFirstWindow() { UnicastSubject window = UnicastSubject.create(bufferSize, this); windows.add(window); - ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept(window); + ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); worker.schedule(new WindowBoundaryRunnable(this, false), timespan, unit); @@ -591,7 +591,7 @@ void drain() { UnicastSubject window = UnicastSubject.create(bufferSize, this); windows.add(window); - ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept(window); + ObservableWindowSubscribeIntercept intercept = new ObservableWindowSubscribeIntercept<>(window); downstream.onNext(intercept); worker.schedule(new WindowBoundaryRunnable(this, false), timespan, unit); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java index 6ac680db30..b7e283c515 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFrom.java @@ -35,8 +35,8 @@ public ObservableWithLatestFrom(ObservableSource source, @Override public void subscribeActual(Observer t) { - final SerializedObserver serial = new SerializedObserver(t); - final WithLatestFromObserver wlf = new WithLatestFromObserver(serial, combiner); + final SerializedObserver serial = new SerializedObserver<>(t); + final WithLatestFromObserver wlf = new WithLatestFromObserver<>(serial, combiner); serial.onSubscribe(wlf); @@ -53,9 +53,9 @@ static final class WithLatestFromObserver extends AtomicReference im final BiFunction combiner; - final AtomicReference upstream = new AtomicReference(); + final AtomicReference upstream = new AtomicReference<>(); - final AtomicReference other = new AtomicReference(); + final AtomicReference other = new AtomicReference<>(); WithLatestFromObserver(Observer actual, BiFunction combiner) { this.downstream = actual; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java index 73d28032fc..c9f2a6b57a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWithLatestFromMany.java @@ -82,11 +82,11 @@ protected void subscribeActual(Observer observer) { } if (n == 0) { - new ObservableMap(source, new SingletonArrayFunc()).subscribeActual(observer); + new ObservableMap<>(source, new SingletonArrayFunc()).subscribeActual(observer); return; } - WithLatestFromObserver parent = new WithLatestFromObserver(observer, combiner, n); + WithLatestFromObserver parent = new WithLatestFromObserver<>(observer, combiner, n); observer.onSubscribe(parent); parent.subscribe(others, n); @@ -121,8 +121,8 @@ static final class WithLatestFromObserver s[i] = new WithLatestInnerObserver(this, i); } this.observers = s; - this.values = new AtomicReferenceArray(n); - this.upstream = new AtomicReference(); + this.values = new AtomicReferenceArray<>(n); + this.upstream = new AtomicReference<>(); this.error = new AtomicThrowable(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java index 80ae9b174b..ace2d748e5 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableZip.java @@ -68,7 +68,7 @@ public void subscribeActual(Observer observer) { return; } - ZipCoordinator zc = new ZipCoordinator(observer, zipper, count, delayError); + ZipCoordinator zc = new ZipCoordinator<>(observer, zipper, count, delayError); zc.subscribe(sources, bufferSize); } @@ -98,7 +98,7 @@ public void subscribe(ObservableSource[] sources, int bufferSize) { ZipObserver[] s = observers; int len = s.length; for (int i = 0; i < len; i++) { - s[i] = new ZipObserver(this, bufferSize); + s[i] = new ZipObserver<>(this, bufferSize); } // this makes sure the contents of the observers array is visible this.lazySet(0); @@ -263,11 +263,11 @@ static final class ZipObserver implements Observer { volatile boolean done; Throwable error; - final AtomicReference upstream = new AtomicReference(); + final AtomicReference upstream = new AtomicReference<>(); ZipObserver(ZipCoordinator parent, int bufferSize) { this.parent = parent; - this.queue = new SpscLinkedArrayQueue(bufferSize); + this.queue = new SpscLinkedArrayQueue<>(bufferSize); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java index 4111a36af4..4245417ce7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObserverResourceWrapper.java @@ -25,7 +25,7 @@ public final class ObserverResourceWrapper extends AtomicReference downstream; - final AtomicReference upstream = new AtomicReference(); + final AtomicReference upstream = new AtomicReference<>(); public ObserverResourceWrapper(Observer downstream) { this.downstream = downstream; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java index 48220d16b1..a8cb63f0ed 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCache.java @@ -39,12 +39,12 @@ public final class SingleCache extends Single implements SingleObserver public SingleCache(SingleSource source) { this.source = source; this.wip = new AtomicInteger(); - this.observers = new AtomicReference[]>(EMPTY); + this.observers = new AtomicReference<>(EMPTY); } @Override protected void subscribeActual(final SingleObserver observer) { - CacheDisposable d = new CacheDisposable(observer, this); + CacheDisposable d = new CacheDisposable<>(observer, this); observer.onSubscribe(d); if (add(d)) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java index a2164d2ec5..8c5331c87b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleCreate.java @@ -33,7 +33,7 @@ public SingleCreate(SingleOnSubscribe source) { @Override protected void subscribeActual(SingleObserver observer) { - Emitter parent = new Emitter(observer); + Emitter parent = new Emitter<>(observer); observer.onSubscribe(parent); try { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java index 9915ff1c66..c3f7458459 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithCompletable.java @@ -33,7 +33,7 @@ public SingleDelayWithCompletable(SingleSource source, CompletableSource othe @Override protected void subscribeActual(SingleObserver observer) { - other.subscribe(new OtherObserver(observer, source)); + other.subscribe(new OtherObserver<>(observer, source)); } static final class OtherObserver @@ -66,7 +66,7 @@ public void onError(Throwable e) { @Override public void onComplete() { - source.subscribe(new ResumeSingleObserver(this, downstream)); + source.subscribe(new ResumeSingleObserver<>(this, downstream)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java index 78c843db4b..a0eb8ab860 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithObservable.java @@ -34,7 +34,7 @@ public SingleDelayWithObservable(SingleSource source, ObservableSource oth @Override protected void subscribeActual(SingleObserver observer) { - other.subscribe(new OtherSubscriber(observer, source)); + other.subscribe(new OtherSubscriber<>(observer, source)); } static final class OtherSubscriber @@ -84,7 +84,7 @@ public void onComplete() { return; } done = true; - source.subscribe(new ResumeSingleObserver(this, downstream)); + source.subscribe(new ResumeSingleObserver<>(this, downstream)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java index 647f55916b..1d8a601a02 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithPublisher.java @@ -37,7 +37,7 @@ public SingleDelayWithPublisher(SingleSource source, Publisher other) { @Override protected void subscribeActual(SingleObserver observer) { - other.subscribe(new OtherSubscriber(observer, source)); + other.subscribe(new OtherSubscriber<>(observer, source)); } static final class OtherSubscriber @@ -92,7 +92,7 @@ public void onComplete() { return; } done = true; - source.subscribe(new ResumeSingleObserver(this, downstream)); + source.subscribe(new ResumeSingleObserver<>(this, downstream)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java index 721d4dc2a5..d8e11665c8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDelayWithSingle.java @@ -33,7 +33,7 @@ public SingleDelayWithSingle(SingleSource source, SingleSource other) { @Override protected void subscribeActual(SingleObserver observer) { - other.subscribe(new OtherObserver(observer, source)); + other.subscribe(new OtherObserver<>(observer, source)); } static final class OtherObserver @@ -61,7 +61,7 @@ public void onSubscribe(Disposable d) { @Override public void onSuccess(U value) { - source.subscribe(new ResumeSingleObserver(this, downstream)); + source.subscribe(new ResumeSingleObserver<>(this, downstream)); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java index 4582e4d4da..6d072f4cea 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDematerialize.java @@ -42,7 +42,7 @@ public SingleDematerialize(Single source, Function @Override protected void subscribeActual(MaybeObserver observer) { - source.subscribe(new DematerializeObserver(observer, selector)); + source.subscribe(new DematerializeObserver<>(observer, selector)); } static final class DematerializeObserver implements SingleObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java index 70e5ae029c..72e1f3def3 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDetach.java @@ -33,7 +33,7 @@ public SingleDetach(SingleSource source) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new DetachSingleObserver(observer)); + source.subscribe(new DetachSingleObserver<>(observer)); } static final class DetachSingleObserver implements SingleObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java index 01fa4ce590..d7ab5e4c79 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterSuccess.java @@ -39,7 +39,7 @@ public SingleDoAfterSuccess(SingleSource source, Consumer onAfterS @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new DoAfterObserver(observer, onAfterSuccess)); + source.subscribe(new DoAfterObserver<>(observer, onAfterSuccess)); } static final class DoAfterObserver implements SingleObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java index bcb604e2ca..eca7ebff15 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoAfterTerminate.java @@ -39,7 +39,7 @@ public SingleDoAfterTerminate(SingleSource source, Action onAfterTerminate) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new DoAfterTerminateObserver(observer, onAfterTerminate)); + source.subscribe(new DoAfterTerminateObserver<>(observer, onAfterTerminate)); } static final class DoAfterTerminateObserver implements SingleObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java index bfa309be03..0ba60a6493 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinally.java @@ -41,7 +41,7 @@ public SingleDoFinally(SingleSource source, Action onFinally) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new DoFinallyObserver(observer, onFinally)); + source.subscribe(new DoFinallyObserver<>(observer, onFinally)); } static final class DoFinallyObserver extends AtomicInteger implements SingleObserver, Disposable { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java index 31dd0183f4..262f4f7d43 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnDispose.java @@ -35,7 +35,7 @@ public SingleDoOnDispose(SingleSource source, Action onDispose) { @Override protected void subscribeActual(final SingleObserver observer) { - source.subscribe(new DoOnDisposeObserver(observer, onDispose)); + source.subscribe(new DoOnDisposeObserver<>(observer, onDispose)); } static final class DoOnDisposeObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java index d7c9230fb7..24a24caac9 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnSubscribe.java @@ -38,7 +38,7 @@ public SingleDoOnSubscribe(SingleSource source, Consumer @Override protected void subscribeActual(final SingleObserver observer) { - source.subscribe(new DoOnSubscribeSingleObserver(observer, onSubscribe)); + source.subscribe(new DoOnSubscribeSingleObserver<>(observer, onSubscribe)); } static final class DoOnSubscribeSingleObserver implements SingleObserver { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java index d4a9f54737..d914799640 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapCompletable.java @@ -39,7 +39,7 @@ public SingleFlatMapCompletable(SingleSource source, Function parent = new FlatMapCompletableObserver(observer, mapper); + FlatMapCompletableObserver parent = new FlatMapCompletableObserver<>(observer, mapper); observer.onSubscribe(parent); source.subscribe(parent); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java index 0d9e4aee0f..9e05a25ef8 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowable.java @@ -48,7 +48,7 @@ public SingleFlatMapIterableFlowable(SingleSource source, @Override protected void subscribeActual(Subscriber s) { - source.subscribe(new FlatMapIterableObserver(s, mapper)); + source.subscribe(new FlatMapIterableObserver<>(s, mapper)); } static final class FlatMapIterableObserver @@ -273,7 +273,7 @@ public boolean isEmpty() { @Nullable @Override - public R poll() throws Exception { + public R poll() { Iterator iterator = it; if (iterator != null) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java index 795f60a3ca..add137d7cb 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableObservable.java @@ -44,7 +44,7 @@ public SingleFlatMapIterableObservable(SingleSource source, @Override protected void subscribeActual(Observer observer) { - source.subscribe(new FlatMapIterableObserver(observer, mapper)); + source.subscribe(new FlatMapIterableObserver<>(observer, mapper)); } static final class FlatMapIterableObserver @@ -183,7 +183,7 @@ public boolean isEmpty() { @Nullable @Override - public R poll() throws Exception { + public R poll() { Iterator iterator = it; if (iterator != null) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java index 4a636ba337..f474830e40 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapPublisher.java @@ -56,7 +56,7 @@ public SingleFlatMapPublisher(SingleSource source, @Override protected void subscribeActual(Subscriber downstream) { - source.subscribe(new SingleFlatMapPublisherObserver(downstream, mapper)); + source.subscribe(new SingleFlatMapPublisherObserver<>(downstream, mapper)); } static final class SingleFlatMapPublisherObserver extends AtomicLong @@ -73,7 +73,7 @@ static final class SingleFlatMapPublisherObserver extends AtomicLong Function> mapper) { this.downstream = actual; this.mapper = mapper; - this.parent = new AtomicReference(); + this.parent = new AtomicReference<>(); } @Override diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java index 8c322ada64..95ed46144c 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleInternalHelper.java @@ -36,17 +36,17 @@ enum NoSuchElementCallable implements Supplier, Callable INSTANCE; @Override - public NoSuchElementException call() throws Exception { + public NoSuchElementException call() { return new NoSuchElementException(); } @Override - public NoSuchElementException get() throws Throwable { + public NoSuchElementException get() { return new NoSuchElementException(); } } - public static Supplier emptyThrower() { + public static Supplier emptyThrower() { return NoSuchElementCallable.INSTANCE; } @@ -79,7 +79,7 @@ public boolean hasNext() { @Override public Flowable next() { - return new SingleToFlowable(sit.next()); + return new SingleToFlowable<>(sit.next()); } @Override @@ -98,12 +98,12 @@ static final class ToFlowableIterable implements Iterable> { @Override public Iterator> iterator() { - return new ToFlowableIterator(sources.iterator()); + return new ToFlowableIterator<>(sources.iterator()); } } public static Iterable> iterableToFlowable(final Iterable> sources) { - return new ToFlowableIterable(sources); + return new ToFlowableIterable<>(sources); } @SuppressWarnings("rawtypes") diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java index fd0afc2f98..1ffbfe073a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleMaterialize.java @@ -34,6 +34,6 @@ public SingleMaterialize(Single source) { @Override protected void subscribeActual(SingleObserver> observer) { - source.subscribe(new MaterializeSingleObserver(observer)); + source.subscribe(new MaterializeSingleObserver<>(observer)); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java index 035f458e11..168a88ee8e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleObserveOn.java @@ -32,7 +32,7 @@ public SingleObserveOn(SingleSource source, Scheduler scheduler) { @Override protected void subscribeActual(final SingleObserver observer) { - source.subscribe(new ObserveOnSingleObserver(observer, scheduler)); + source.subscribe(new ObserveOnSingleObserver<>(observer, scheduler)); } static final class ObserveOnSingleObserver extends AtomicReference diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java index 6f768591e8..070b244747 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleResumeNext.java @@ -36,7 +36,7 @@ public SingleResumeNext(SingleSource source, @Override protected void subscribeActual(final SingleObserver observer) { - source.subscribe(new ResumeMainSingleObserver(observer, nextFunction)); + source.subscribe(new ResumeMainSingleObserver<>(observer, nextFunction)); } static final class ResumeMainSingleObserver extends AtomicReference diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java index 79187148cd..3347fc1989 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleSubscribeOn.java @@ -31,7 +31,7 @@ public SingleSubscribeOn(SingleSource source, Scheduler scheduler) @Override protected void subscribeActual(final SingleObserver observer) { - final SubscribeOnObserver parent = new SubscribeOnObserver(observer, source); + final SubscribeOnObserver parent = new SubscribeOnObserver<>(observer, source); observer.onSubscribe(parent); Disposable f = scheduler.scheduleDirect(parent); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java index e69ac1b118..50e8b89763 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTakeUntil.java @@ -43,7 +43,7 @@ public SingleTakeUntil(SingleSource source, Publisher other) { @Override protected void subscribeActual(SingleObserver observer) { - TakeUntilMainObserver parent = new TakeUntilMainObserver(observer); + TakeUntilMainObserver parent = new TakeUntilMainObserver<>(observer); observer.onSubscribe(parent); other.subscribe(parent.other); diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java index 1cb417c8db..f529d02446 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleTimeout.java @@ -47,7 +47,7 @@ public SingleTimeout(SingleSource source, long timeout, TimeUnit unit, Schedu @Override protected void subscribeActual(final SingleObserver observer) { - TimeoutMainObserver parent = new TimeoutMainObserver(observer, other, timeout, unit); + TimeoutMainObserver parent = new TimeoutMainObserver<>(observer, other, timeout, unit); observer.onSubscribe(parent); DisposableHelper.replace(parent.task, scheduler.scheduleDirect(parent, timeout, unit)); @@ -103,9 +103,9 @@ public void onError(Throwable e) { this.other = other; this.timeout = timeout; this.unit = unit; - this.task = new AtomicReference(); + this.task = new AtomicReference<>(); if (other != null) { - this.fallback = new TimeoutFallbackObserver(actual); + this.fallback = new TimeoutFallbackObserver<>(actual); } else { this.fallback = null; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java index 18ecef340f..810adaea3f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleToObservable.java @@ -44,7 +44,7 @@ public void subscribeActual(final Observer observer) { * @since 2.2 */ public static SingleObserver create(Observer downstream) { - return new SingleToObservableObserver(downstream); + return new SingleToObservableObserver<>(downstream); } static final class SingleToObservableObserver diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java index 3f5b20b20c..9a78d61bb7 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleUnsubscribeOn.java @@ -37,7 +37,7 @@ public SingleUnsubscribeOn(SingleSource source, Scheduler scheduler) { @Override protected void subscribeActual(SingleObserver observer) { - source.subscribe(new UnsubscribeOnSingleObserver(observer, scheduler)); + source.subscribe(new UnsubscribeOnSingleObserver<>(observer, scheduler)); } static final class UnsubscribeOnSingleObserver extends AtomicReference diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java index b207476c95..9130a2bf35 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipArray.java @@ -40,11 +40,11 @@ protected void subscribeActual(SingleObserver observer) { int n = sources.length; if (n == 1) { - sources[0].subscribe(new SingleMap.MapSingleObserver(observer, new SingletonArrayFunc())); + sources[0].subscribe(new SingleMap.MapSingleObserver<>(observer, new SingletonArrayFunc())); return; } - ZipCoordinator parent = new ZipCoordinator(observer, n, zipper); + ZipCoordinator parent = new ZipCoordinator<>(observer, n, zipper); observer.onSubscribe(parent); @@ -83,7 +83,7 @@ static final class ZipCoordinator extends AtomicInteger implements Disposa this.zipper = zipper; ZipSingleObserver[] o = new ZipSingleObserver[n]; for (int i = 0; i < n; i++) { - o[i] = new ZipSingleObserver(this, i); + o[i] = new ZipSingleObserver<>(this, i); } this.observers = o; this.values = new Object[n]; diff --git a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java index b41538aeb4..ad393987be 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java +++ b/src/main/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterable.java @@ -61,11 +61,11 @@ protected void subscribeActual(SingleObserver observer) { } if (n == 1) { - a[0].subscribe(new SingleMap.MapSingleObserver(observer, new SingletonArrayFunc())); + a[0].subscribe(new SingleMap.MapSingleObserver<>(observer, new SingletonArrayFunc())); return; } - ZipCoordinator parent = new ZipCoordinator(observer, n, zipper); + ZipCoordinator parent = new ZipCoordinator<>(observer, n, zipper); observer.onSubscribe(parent); diff --git a/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java b/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java index 8458e8d876..31fe6eca9b 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java +++ b/src/main/java/io/reactivex/rxjava3/internal/queue/MpscLinkedQueue.java @@ -32,9 +32,9 @@ public final class MpscLinkedQueue implements SimplePlainQueue { private final AtomicReference> consumerNode; public MpscLinkedQueue() { - producerNode = new AtomicReference>(); - consumerNode = new AtomicReference>(); - LinkedQueueNode node = new LinkedQueueNode(); + producerNode = new AtomicReference<>(); + consumerNode = new AtomicReference<>(); + LinkedQueueNode node = new LinkedQueueNode<>(); spConsumerNode(node); xchgProducerNode(node); // this ensures correct construction: StoreLoad } @@ -59,7 +59,7 @@ public boolean offer(final T e) { if (null == e) { throw new NullPointerException("Null is not a valid element"); } - final LinkedQueueNode nextNode = new LinkedQueueNode(e); + final LinkedQueueNode nextNode = new LinkedQueueNode<>(e); final LinkedQueueNode prevProducerNode = xchgProducerNode(nextNode); // Should a producer thread get interrupted here the chain WILL be broken until that thread is resumed // and completes the store in prev.next. diff --git a/src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java b/src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java index 4a2a182dfc..2bd61dcc15 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java +++ b/src/main/java/io/reactivex/rxjava3/internal/queue/SpscLinkedArrayQueue.java @@ -48,7 +48,7 @@ public final class SpscLinkedArrayQueue implements SimplePlainQueue { public SpscLinkedArrayQueue(final int bufferSize) { int p2capacity = Pow2.roundToPowerOfTwo(Math.max(8, bufferSize)); int mask = p2capacity - 1; - AtomicReferenceArray buffer = new AtomicReferenceArray(p2capacity + 1); + AtomicReferenceArray buffer = new AtomicReferenceArray<>(p2capacity + 1); producerBuffer = buffer; producerMask = mask; adjustLookAheadStep(p2capacity); @@ -100,7 +100,7 @@ private boolean writeToQueue(final AtomicReferenceArray buffer, final T private void resize(final AtomicReferenceArray oldBuffer, final long currIndex, final int offset, final T e, final long mask) { final int capacity = oldBuffer.length(); - final AtomicReferenceArray newBuffer = new AtomicReferenceArray(capacity); + final AtomicReferenceArray newBuffer = new AtomicReferenceArray<>(capacity); producerBuffer = newBuffer; producerLookAhead = currIndex + mask - 1; soElement(newBuffer, offset, e); // StoreStore @@ -247,7 +247,7 @@ private static void soElement(AtomicReferenceArray buffer, int offset, O buffer.lazySet(offset, e); } - private static Object lvElement(AtomicReferenceArray buffer, int offset) { + private static Object lvElement(AtomicReferenceArray buffer, int offset) { return buffer.get(offset); } @@ -273,7 +273,7 @@ public boolean offer(T first, T second) { soProducerIndex(p + 2); } else { final int capacity = buffer.length(); - final AtomicReferenceArray newBuffer = new AtomicReferenceArray(capacity); + final AtomicReferenceArray newBuffer = new AtomicReferenceArray<>(capacity); producerBuffer = newBuffer; pi = calcWrappedOffset(p, m); diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java index 2788bdfec6..a1c4bc2ce1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTask.java @@ -37,9 +37,9 @@ abstract class AbstractDirectTask protected Thread runner; - protected static final FutureTask FINISHED = new FutureTask(Functions.EMPTY_RUNNABLE, null); + protected static final FutureTask FINISHED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null); - protected static final FutureTask DISPOSED = new FutureTask(Functions.EMPTY_RUNNABLE, null); + protected static final FutureTask DISPOSED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null); AbstractDirectTask(Runnable runnable) { this.runnable = runnable; diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java index eb686b17e0..e0bf388772 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ComputationScheduler.java @@ -135,7 +135,7 @@ public ComputationScheduler() { */ public ComputationScheduler(ThreadFactory threadFactory) { this.threadFactory = threadFactory; - this.pool = new AtomicReference(NONE); + this.pool = new AtomicReference<>(NONE); start(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java index 231cb5b3f2..370fb5d8a2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/DisposeOnCancel.java @@ -15,6 +15,7 @@ import java.util.concurrent.*; +import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.disposables.Disposable; /** @@ -46,13 +47,12 @@ public boolean isDone() { } @Override - public Object get() throws InterruptedException, ExecutionException { + public Object get() { return null; } @Override - public Object get(long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { + public Object get(long timeout, @NonNull TimeUnit unit) { return null; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java index 8fd7b33720..a9547e64e1 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ExecutorScheduler.java @@ -140,7 +140,7 @@ public static final class ExecutorWorker extends Scheduler.Worker implements Run public ExecutorWorker(Executor executor, boolean interruptibleWorker, boolean fair) { this.executor = executor; - this.queue = new MpscLinkedQueue(); + this.queue = new MpscLinkedQueue<>(); this.interruptibleWorker = interruptibleWorker; this.fair = fair; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java index 5df8793ebb..a855b44683 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/InstantPeriodicTask.java @@ -39,18 +39,18 @@ final class InstantPeriodicTask implements Callable, Disposable { Thread runner; - static final FutureTask CANCELLED = new FutureTask(Functions.EMPTY_RUNNABLE, null); + static final FutureTask CANCELLED = new FutureTask<>(Functions.EMPTY_RUNNABLE, null); InstantPeriodicTask(Runnable task, ExecutorService executor) { super(); this.task = task; - this.first = new AtomicReference>(); - this.rest = new AtomicReference>(); + this.first = new AtomicReference<>(); + this.rest = new AtomicReference<>(); this.executor = executor; } @Override - public Void call() throws Exception { + public Void call() { runner = Thread.currentThread(); try { task.run(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java index f4edcf0208..3a4bac58b2 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/IoScheduler.java @@ -77,7 +77,7 @@ static final class CachedWorkerPool implements Runnable { CachedWorkerPool(long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory) { this.keepAliveTime = unit != null ? unit.toNanos(keepAliveTime) : 0L; - this.expiringWorkerQueue = new ConcurrentLinkedQueue(); + this.expiringWorkerQueue = new ConcurrentLinkedQueue<>(); this.allWorkers = new CompositeDisposable(); this.threadFactory = threadFactory; @@ -164,7 +164,7 @@ public IoScheduler() { */ public IoScheduler(ThreadFactory threadFactory) { this.threadFactory = threadFactory; - this.pool = new AtomicReference(NONE); + this.pool = new AtomicReference<>(NONE); start(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java index 7d0646056d..5bd0614b89 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/RxThreadFactory.java @@ -13,6 +13,8 @@ package io.reactivex.rxjava3.internal.schedulers; +import io.reactivex.rxjava3.annotations.NonNull; + import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicLong; @@ -47,7 +49,7 @@ public RxThreadFactory(String prefix, int priority, boolean nonBlocking) { } @Override - public Thread newThread(Runnable r) { + public Thread newThread(@NonNull Runnable r) { StringBuilder nameBuilder = new StringBuilder(prefix).append('-').append(incrementAndGet()); // if (CREATE_TRACE) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java index 89bd9d3d01..d48ccf8ab6 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/ScheduledDirectTask.java @@ -32,7 +32,7 @@ public ScheduledDirectTask(Runnable runnable) { } @Override - public Void call() throws Exception { + public Void call() { runner = Thread.currentThread(); try { runnable.run(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java index 392a3c3051..333d4ded9e 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SchedulerPoolFactory.java @@ -47,12 +47,12 @@ private SchedulerPoolFactory() { public static final int PURGE_PERIOD_SECONDS; static final AtomicReference PURGE_THREAD = - new AtomicReference(); + new AtomicReference<>(); // Upcast to the Map interface here to avoid 8.x compatibility issues. // See http://stackoverflow.com/a/32955708/61158 static final Map POOLS = - new ConcurrentHashMap(); + new ConcurrentHashMap<>(); /** * Starts the purge thread if not already started. @@ -134,7 +134,7 @@ static boolean getBooleanProperty(boolean enabled, String key, boolean defaultNo static final class SystemPropertyAccessor implements Function { @Override - public String apply(String t) throws Throwable { + public String apply(String t) { return System.getProperty(t); } } @@ -160,7 +160,7 @@ static void tryPutIntoPool(boolean purgeEnabled, ScheduledExecutorService exec) static final class ScheduledTask implements Runnable { @Override public void run() { - for (ScheduledThreadPoolExecutor e : new ArrayList(POOLS.keySet())) { + for (ScheduledThreadPoolExecutor e : new ArrayList<>(POOLS.keySet())) { if (e.isShutdown()) { POOLS.remove(e); } else { diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java index a1dba3036b..13c7430f94 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/SingleScheduler.java @@ -28,7 +28,7 @@ public final class SingleScheduler extends Scheduler { final ThreadFactory threadFactory; - final AtomicReference executor = new AtomicReference(); + final AtomicReference executor = new AtomicReference<>(); /** The name of the system property for setting the thread priority for this Scheduler. */ private static final String KEY_SINGLE_PRIORITY = "rx3.single-priority"; diff --git a/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java b/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java index b8a164f9e1..5ddd867783 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java +++ b/src/main/java/io/reactivex/rxjava3/internal/schedulers/TrampolineScheduler.java @@ -66,7 +66,7 @@ public Disposable scheduleDirect(@NonNull Runnable run, long delay, TimeUnit uni } static final class TrampolineWorker extends Scheduler.Worker implements Disposable { - final PriorityBlockingQueue queue = new PriorityBlockingQueue(); + final PriorityBlockingQueue queue = new PriorityBlockingQueue<>(); private final AtomicInteger wip = new AtomicInteger(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java index 1e09f5b414..59edd4f80d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/FutureSubscriber.java @@ -19,6 +19,7 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; +import io.reactivex.rxjava3.annotations.NonNull; import org.reactivestreams.Subscription; import io.reactivex.rxjava3.core.FlowableSubscriber; @@ -42,7 +43,7 @@ public final class FutureSubscriber extends CountDownLatch public FutureSubscriber() { super(1); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); } @Override @@ -91,7 +92,7 @@ public T get() throws InterruptedException, ExecutionException { } @Override - public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + public T get(long timeout, @NonNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java index 32668ed4d9..f351126044 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/StrictSubscriber.java @@ -57,7 +57,7 @@ public StrictSubscriber(Subscriber downstream) { this.downstream = downstream; this.error = new AtomicThrowable(); this.requested = new AtomicLong(); - this.upstream = new AtomicReference(); + this.upstream = new AtomicReference<>(); this.once = new AtomicBoolean(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java b/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java index 55d052c705..4c9b6b4930 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscribers/SubscriberResourceWrapper.java @@ -28,7 +28,7 @@ public final class SubscriberResourceWrapper extends AtomicReference downstream; - final AtomicReference upstream = new AtomicReference(); + final AtomicReference upstream = new AtomicReference<>(); public SubscriberResourceWrapper(Subscriber downstream) { this.downstream = downstream; diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java index 370c45ffbe..62973e7440 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/AsyncSubscription.java @@ -35,8 +35,8 @@ public final class AsyncSubscription extends AtomicLong implements Subscription, final AtomicReference resource; public AsyncSubscription() { - resource = new AtomicReference(); - actual = new AtomicReference(); + resource = new AtomicReference<>(); + actual = new AtomicReference<>(); } public AsyncSubscription(Disposable resource) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java index 6a50ab07dc..44c5fe5845 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java +++ b/src/main/java/io/reactivex/rxjava3/internal/subscriptions/SubscriptionArbiter.java @@ -63,7 +63,7 @@ public class SubscriptionArbiter extends AtomicInteger implements Subscription { public SubscriptionArbiter(boolean cancelOnReplace) { this.cancelOnReplace = cancelOnReplace; - missedSubscription = new AtomicReference(); + missedSubscription = new AtomicReference<>(); missedRequested = new AtomicLong(); missedProduced = new AtomicLong(); } diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java index 1f82daf237..7338c99040 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ArrayListSupplier.java @@ -32,10 +32,10 @@ public static Function> asFunction() { @Override public List get() { - return new ArrayList(); + return new ArrayList<>(); } @Override public List apply(Object o) { - return new ArrayList(); + return new ArrayList<>(); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java b/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java index 4d4f160a8a..63fd12dc99 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ConnectConsumer.java @@ -23,7 +23,7 @@ public final class ConnectConsumer implements Consumer { public Disposable disposable; @Override - public void accept(Disposable t) throws Exception { + public void accept(Disposable t) { this.disposable = t; } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java b/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java index c4aaadb343..8b9d62317a 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ExceptionHelper.java @@ -52,7 +52,7 @@ public static RuntimeException wrapOrThrow(Throwable error) { */ public static final Throwable TERMINATED = new Termination(); - public static boolean addThrowable(AtomicReference field, Throwable exception) { + public static boolean addThrowable(AtomicReference field, Throwable exception) { for (;;) { Throwable current = field.get(); @@ -73,7 +73,7 @@ public static boolean addThrowable(AtomicReference field, Throwab } } - public static Throwable terminate(AtomicReference field) { + public static Throwable terminate(AtomicReference field) { Throwable current = field.get(); if (current != TERMINATED) { current = field.getAndSet(TERMINATED); @@ -87,8 +87,8 @@ public static Throwable terminate(AtomicReference field) { * @return the list of Throwables flattened in a depth-first manner */ public static List flatten(Throwable t) { - List list = new ArrayList(); - ArrayDeque deque = new ArrayDeque(); + List list = new ArrayList<>(); + ArrayDeque deque = new ArrayDeque<>(); deque.offer(t); while (!deque.isEmpty()) { diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java b/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java index 22d9900d19..46236ff293 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/HashMapSupplier.java @@ -26,6 +26,6 @@ public static Supplier> asSupplier() { } @Override public Map get() { - return new HashMap(); + return new HashMap<>(); } } diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java b/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java index f4b1d4aae2..08d675a4af 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/LinkedArrayList.java @@ -92,7 +92,7 @@ public int size() { public String toString() { final int cap = capacityHint; final int s = size; - final List list = new ArrayList(s + 1); + final List list = new ArrayList<>(s + 1); Object[] h = head(); int j = 0; diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java b/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java index 9f484f1700..cd6c8e9750 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/ListAddBiConsumer.java @@ -28,7 +28,7 @@ public static BiFunction, T, List> instance() { @SuppressWarnings("unchecked") @Override - public List apply(List t1, Object t2) throws Exception { + public List apply(List t1, Object t2) { t1.add(t2); return t1; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java b/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java index 9efe097a7c..64d9faff71 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/MergerBiFunction.java @@ -30,12 +30,12 @@ public MergerBiFunction(Comparator comparator) { } @Override - public List apply(List a, List b) throws Exception { + public List apply(List a, List b) { int n = a.size() + b.size(); if (n == 0) { - return new ArrayList(); + return new ArrayList<>(); } - List both = new ArrayList(n); + List both = new ArrayList<>(n); Iterator at = a.iterator(); Iterator bt = b.iterator(); diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java b/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java index 9cdfab07ce..9808e2fe0d 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/QueueDrainHelper.java @@ -212,9 +212,9 @@ public static boolean checkTerminated(boolean d, boolean empty, */ public static SimpleQueue createQueue(int capacityHint) { if (capacityHint < 0) { - return new SpscLinkedArrayQueue(-capacityHint); + return new SpscLinkedArrayQueue<>(-capacityHint); } - return new SpscArrayQueue(capacityHint); + return new SpscArrayQueue<>(capacityHint); } /** diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java b/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java index 5a9929f604..a62efd154f 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/SorterFunction.java @@ -26,7 +26,7 @@ public SorterFunction(Comparator comparator) { } @Override - public List apply(List t) throws Exception { + public List apply(List t) { Collections.sort(t, comparator); return t; } diff --git a/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java b/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java index 301dc634fa..33e1e18a56 100644 --- a/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java +++ b/src/main/java/io/reactivex/rxjava3/internal/util/VolatileSizeArrayList.java @@ -13,6 +13,8 @@ package io.reactivex.rxjava3.internal.util; +import io.reactivex.rxjava3.annotations.NonNull; + import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -29,11 +31,11 @@ public final class VolatileSizeArrayList extends AtomicInteger implements Lis final ArrayList list; public VolatileSizeArrayList() { - list = new ArrayList(); + list = new ArrayList<>(); } public VolatileSizeArrayList(int initialCapacity) { - list = new ArrayList(initialCapacity); + list = new ArrayList<>(initialCapacity); } @Override @@ -62,7 +64,7 @@ public Object[] toArray() { } @Override - public E[] toArray(E[] a) { + public E[] toArray(@NonNull E[] a) { return list.toArray(a); } @@ -81,33 +83,33 @@ public boolean remove(Object o) { } @Override - public boolean containsAll(Collection c) { + public boolean containsAll(@NonNull Collection c) { return list.containsAll(c); } @Override - public boolean addAll(Collection c) { + public boolean addAll(@NonNull Collection c) { boolean b = list.addAll(c); lazySet(list.size()); return b; } @Override - public boolean addAll(int index, Collection c) { + public boolean addAll(int index, @NonNull Collection c) { boolean b = list.addAll(index, c); lazySet(list.size()); return b; } @Override - public boolean removeAll(Collection c) { + public boolean removeAll(@NonNull Collection c) { boolean b = list.removeAll(c); lazySet(list.size()); return b; } @Override - public boolean retainAll(Collection c) { + public boolean retainAll(@NonNull Collection c) { boolean b = list.retainAll(c); lazySet(list.size()); return b; diff --git a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java index c8fbf203ef..ea09fb53d4 100644 --- a/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java +++ b/src/main/java/io/reactivex/rxjava3/parallel/ParallelFlowable.java @@ -24,7 +24,6 @@ import io.reactivex.rxjava3.internal.functions.*; import io.reactivex.rxjava3.internal.jdk8.*; import io.reactivex.rxjava3.internal.operators.parallel.*; -import io.reactivex.rxjava3.internal.operators.parallel.ParallelReduceFull; import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription; import io.reactivex.rxjava3.internal.util.*; import io.reactivex.rxjava3.plugins.RxJavaPlugins; @@ -161,7 +160,7 @@ public static ParallelFlowable from(@NonNull Publisher sourc ObjectHelper.verifyPositive(parallelism, "parallelism"); ObjectHelper.verifyPositive(prefetch, "prefetch"); - return RxJavaPlugins.onAssembly(new ParallelFromPublisher(source, parallelism, prefetch)); + return RxJavaPlugins.onAssembly(new ParallelFromPublisher<>(source, parallelism, prefetch)); } /** @@ -185,7 +184,7 @@ public static ParallelFlowable from(@NonNull Publisher sourc @BackpressureSupport(BackpressureKind.PASS_THROUGH) public final ParallelFlowable map(@NonNull Function mapper) { Objects.requireNonNull(mapper, "mapper"); - return RxJavaPlugins.onAssembly(new ParallelMap(this, mapper)); + return RxJavaPlugins.onAssembly(new ParallelMap<>(this, mapper)); } /** @@ -215,7 +214,7 @@ public final ParallelFlowable map(@NonNull Function ParallelFlowable map(@NonNull Function mapper, @NonNull ParallelFailureHandling errorHandler) { Objects.requireNonNull(mapper, "mapper"); Objects.requireNonNull(errorHandler, "errorHandler is null"); - return RxJavaPlugins.onAssembly(new ParallelMapTry(this, mapper, errorHandler)); + return RxJavaPlugins.onAssembly(new ParallelMapTry<>(this, mapper, errorHandler)); } /** @@ -246,7 +245,7 @@ public final ParallelFlowable map(@NonNull Function ParallelFlowable map(@NonNull Function mapper, @NonNull BiFunction errorHandler) { Objects.requireNonNull(mapper, "mapper"); Objects.requireNonNull(errorHandler, "errorHandler is null"); - return RxJavaPlugins.onAssembly(new ParallelMapTry(this, mapper, errorHandler)); + return RxJavaPlugins.onAssembly(new ParallelMapTry<>(this, mapper, errorHandler)); } /** @@ -620,8 +619,8 @@ public final Flowable sorted(@NonNull Comparator comparator, int c Objects.requireNonNull(comparator, "comparator is null"); ObjectHelper.verifyPositive(capacityHint, "capacityHint"); int ch = capacityHint / parallelism() + 1; - ParallelFlowable> railReduced = reduce(Functions.createArrayList(ch), ListAddBiConsumer.instance()); - ParallelFlowable> railSorted = railReduced.map(new SorterFunction(comparator)); + ParallelFlowable> railReduced = reduce(Functions.createArrayList(ch), ListAddBiConsumer.instance()); + ParallelFlowable> railSorted = railReduced.map(new SorterFunction<>(comparator)); return RxJavaPlugins.onAssembly(new ParallelSortedJoin<>(railSorted, comparator)); } @@ -673,10 +672,10 @@ public final Flowable> toSortedList(@NonNull Comparator compa ObjectHelper.verifyPositive(capacityHint, "capacityHint"); int ch = capacityHint / parallelism() + 1; - ParallelFlowable> railReduced = reduce(Functions.createArrayList(ch), ListAddBiConsumer.instance()); - ParallelFlowable> railSorted = railReduced.map(new SorterFunction(comparator)); + ParallelFlowable> railReduced = reduce(Functions.createArrayList(ch), ListAddBiConsumer.instance()); + ParallelFlowable> railSorted = railReduced.map(new SorterFunction<>(comparator)); - Flowable> merged = railSorted.reduce(new MergerBiFunction(comparator)); + Flowable> merged = railSorted.reduce(new MergerBiFunction<>(comparator)); return RxJavaPlugins.onAssembly(merged); } @@ -1008,7 +1007,7 @@ public final ParallelFlowable doOnCancel(@NonNull Action onCancel) { public final ParallelFlowable collect(@NonNull Supplier collectionSupplier, @NonNull BiConsumer collector) { Objects.requireNonNull(collectionSupplier, "collectionSupplier is null"); Objects.requireNonNull(collector, "collector is null"); - return RxJavaPlugins.onAssembly(new ParallelCollect(this, collectionSupplier, collector)); + return RxJavaPlugins.onAssembly(new ParallelCollect<>(this, collectionSupplier, collector)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java index ea300afe34..8a20c9140d 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/MulticastProcessor.java @@ -558,7 +558,7 @@ void drain() { } if (as != bs) { - continue outer; + continue; } if (done && q.isEmpty()) { diff --git a/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java b/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java index 9b722057b9..b7880d6833 100644 --- a/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java +++ b/src/main/java/io/reactivex/rxjava3/processors/ReplayProcessor.java @@ -30,7 +30,7 @@ /** * Replays events to Subscribers. *

- * The {@code ReplayProcessor} supports the following item retainment strategies: + * The {@code ReplayProcessor} supports the following item retention strategies: *

    *
  • {@link #create()} and {@link #create(int)}: retains and replays all events to current and * future {@code Subscriber}s. @@ -173,7 +173,7 @@ public final class ReplayProcessor extends FlowableProcessor { @CheckReturnValue @NonNull public static ReplayProcessor create() { - return new ReplayProcessor<>(new UnboundedReplayBuffer(16)); + return new ReplayProcessor<>(new UnboundedReplayBuffer<>(16)); } /** @@ -194,7 +194,7 @@ public static ReplayProcessor create() { @CheckReturnValue @NonNull public static ReplayProcessor create(int capacityHint) { - return new ReplayProcessor<>(new UnboundedReplayBuffer(capacityHint)); + return new ReplayProcessor<>(new UnboundedReplayBuffer<>(capacityHint)); } /** @@ -220,7 +220,7 @@ public static ReplayProcessor create(int capacityHint) { @CheckReturnValue @NonNull public static ReplayProcessor createWithSize(int maxSize) { - return new ReplayProcessor<>(new SizeBoundReplayBuffer(maxSize)); + return new ReplayProcessor<>(new SizeBoundReplayBuffer<>(maxSize)); } /** @@ -238,7 +238,7 @@ public static ReplayProcessor createWithSize(int maxSize) { */ @CheckReturnValue /* test */ static ReplayProcessor createUnbounded() { - return new ReplayProcessor<>(new SizeBoundReplayBuffer(Integer.MAX_VALUE)); + return new ReplayProcessor<>(new SizeBoundReplayBuffer<>(Integer.MAX_VALUE)); } /** @@ -276,7 +276,7 @@ public static ReplayProcessor createWithSize(int maxSize) { @CheckReturnValue @NonNull public static ReplayProcessor createWithTime(long maxAge, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return new ReplayProcessor<>(new SizeAndTimeBoundReplayBuffer(Integer.MAX_VALUE, maxAge, unit, scheduler)); + return new ReplayProcessor<>(new SizeAndTimeBoundReplayBuffer<>(Integer.MAX_VALUE, maxAge, unit, scheduler)); } /** @@ -316,7 +316,7 @@ public static ReplayProcessor createWithTime(long maxAge, @NonNull TimeUn @CheckReturnValue @NonNull public static ReplayProcessor createWithTimeAndSize(long maxAge, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, int maxSize) { - return new ReplayProcessor<>(new SizeAndTimeBoundReplayBuffer(maxSize, maxAge, unit, scheduler)); + return new ReplayProcessor<>(new SizeAndTimeBoundReplayBuffer<>(maxSize, maxAge, unit, scheduler)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java b/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java index 254511f5e0..4d4c3517a5 100644 --- a/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java +++ b/src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java @@ -112,8 +112,8 @@ private Schedulers() { * before the {@link Schedulers} class is referenced in your code. *

    Supported system properties ({@code System.getProperty()}): *

      - *
    • {@code rx3.computation-threads} (int): sets the number of threads in the {@link #computation()} Scheduler, default is the number of available CPUs
    • - *
    • {@code rx3.computation-priority} (int): sets the thread priority of the {@link #computation()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • + *
    • {@code rx3.computation-threads} (int): sets the number of threads in the {@code computation()} Scheduler, default is the number of available CPUs
    • + *
    • {@code rx3.computation-priority} (int): sets the thread priority of the {@code computation()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • *
    *

    * The default value of this scheduler can be overridden at initialization time via the @@ -157,8 +157,8 @@ public static Scheduler computation() { * before the {@link Schedulers} class is referenced in your code. *

    Supported system properties ({@code System.getProperty()}): *

      - *
    • {@code rx3.io-keep-alive-time} (long): sets the keep-alive time of the {@link #io()} Scheduler workers, default is {@link IoScheduler#KEEP_ALIVE_TIME_DEFAULT}
    • - *
    • {@code rx3.io-priority} (int): sets the thread priority of the {@link #io()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • + *
    • {@code rx3.io-keep-alive-time} (long): sets the keep-alive time of the {@code io()} Scheduler workers, default is {@link IoScheduler#KEEP_ALIVE_TIME_DEFAULT}
    • + *
    • {@code rx3.io-priority} (int): sets the thread priority of the {@code io()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • *
    *

    * The default value of this scheduler can be overridden at initialization time via the @@ -216,7 +216,7 @@ public static Scheduler trampoline() { * before the {@link Schedulers} class is referenced in your code. *

    Supported system properties ({@code System.getProperty()}): *

      - *
    • {@code rx3.newthread-priority} (int): sets the thread priority of the {@link #newThread()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • + *
    • {@code rx3.newthread-priority} (int): sets the thread priority of the {@code newThread()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • *
    *

    * The default value of this scheduler can be overridden at initialization time via the @@ -265,7 +265,7 @@ public static Scheduler newThread() { * before the {@link Schedulers} class is referenced in your code. *

    Supported system properties ({@code System.getProperty()}): *

      - *
    • {@code rx3.single-priority} (int): sets the thread priority of the {@link #single()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • + *
    • {@code rx3.single-priority} (int): sets the thread priority of the {@code single()} Scheduler, default is {@link Thread#NORM_PRIORITY}
    • *
    *

    * The default value of this scheduler can be overridden at initialization time via the @@ -522,28 +522,28 @@ public static void start() { static final class IOTask implements Supplier { @Override - public Scheduler get() throws Exception { + public Scheduler get() { return IoHolder.DEFAULT; } } static final class NewThreadTask implements Supplier { @Override - public Scheduler get() throws Exception { + public Scheduler get() { return NewThreadHolder.DEFAULT; } } static final class SingleTask implements Supplier { @Override - public Scheduler get() throws Exception { + public Scheduler get() { return SingleHolder.DEFAULT; } } static final class ComputationTask implements Supplier { @Override - public Scheduler get() throws Exception { + public Scheduler get() { return ComputationHolder.DEFAULT; } } diff --git a/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java b/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java index 9bb3d93b99..efad31e669 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/ReplaySubject.java @@ -160,7 +160,7 @@ public final class ReplaySubject extends Subject { @CheckReturnValue @NonNull public static ReplaySubject create() { - return new ReplaySubject<>(new UnboundedReplayBuffer(16)); + return new ReplaySubject<>(new UnboundedReplayBuffer<>(16)); } /** @@ -181,7 +181,7 @@ public static ReplaySubject create() { @CheckReturnValue @NonNull public static ReplaySubject create(int capacityHint) { - return new ReplaySubject<>(new UnboundedReplayBuffer(capacityHint)); + return new ReplaySubject<>(new UnboundedReplayBuffer<>(capacityHint)); } /** @@ -207,7 +207,7 @@ public static ReplaySubject create(int capacityHint) { @CheckReturnValue @NonNull public static ReplaySubject createWithSize(int maxSize) { - return new ReplaySubject<>(new SizeBoundReplayBuffer(maxSize)); + return new ReplaySubject<>(new SizeBoundReplayBuffer<>(maxSize)); } /** @@ -224,7 +224,7 @@ public static ReplaySubject createWithSize(int maxSize) { * @return the created subject */ /* test */ static ReplaySubject createUnbounded() { - return new ReplaySubject<>(new SizeBoundReplayBuffer(Integer.MAX_VALUE)); + return new ReplaySubject<>(new SizeBoundReplayBuffer<>(Integer.MAX_VALUE)); } /** @@ -262,7 +262,7 @@ public static ReplaySubject createWithSize(int maxSize) { @CheckReturnValue @NonNull public static ReplaySubject createWithTime(long maxAge, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return new ReplaySubject<>(new SizeAndTimeBoundReplayBuffer(Integer.MAX_VALUE, maxAge, unit, scheduler)); + return new ReplaySubject<>(new SizeAndTimeBoundReplayBuffer<>(Integer.MAX_VALUE, maxAge, unit, scheduler)); } /** @@ -302,7 +302,7 @@ public static ReplaySubject createWithTime(long maxAge, @NonNull TimeUnit @CheckReturnValue @NonNull public static ReplaySubject createWithTimeAndSize(long maxAge, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, int maxSize) { - return new ReplaySubject<>(new SizeAndTimeBoundReplayBuffer(maxSize, maxAge, unit, scheduler)); + return new ReplaySubject<>(new SizeAndTimeBoundReplayBuffer<>(maxSize, maxAge, unit, scheduler)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java b/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java index 8f495a9ca5..5e19604eed 100644 --- a/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java +++ b/src/main/java/io/reactivex/rxjava3/subjects/UnicastSubject.java @@ -30,7 +30,7 @@ /** * A Subject that queues up events until a single {@link Observer} subscribes to it, replays * those events to it until the {@code Observer} catches up and then switches to relaying events live to - * this single {@code Observer} until this {@code UnicastSubject} terminates or the {@code Observer} unsubscribes. + * this single {@code Observer} until this {@code UnicastSubject} terminates or the {@code Observer} disposes. *

    * *

    @@ -48,10 +48,10 @@ * optionally delays an error it receives and replays it after the regular items have been emitted.

  • *
  • {@link #create(int, Runnable)} - creates an empty, unbounded {@code UnicastSubject} * with a hint about how many total items one expects to retain and a callback that will be - * called exactly once when the {@code UnicastSubject} gets terminated or the single {@code Observer} unsubscribes.
  • + * called exactly once when the {@code UnicastSubject} gets terminated or the single {@code Observer} disposes. *
  • {@link #create(int, Runnable, boolean)} - creates an empty, unbounded {@code UnicastSubject} * with a hint about how many total items one expects to retain and a callback that will be - * called exactly once when the {@code UnicastSubject} gets terminated or the single {@code Observer} unsubscribes + * called exactly once when the {@code UnicastSubject} gets terminated or the single {@code Observer} disposes * and optionally delays an error it receives and replays it after the regular items have been emitted.
  • *
*

@@ -510,7 +510,7 @@ public int requestFusion(int mode) { @Nullable @Override - public T poll() throws Exception { + public T poll() { return queue.poll(); }