Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused else from the Observable #6485

Merged
merged 2 commits into from
May 23, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 65 additions & 21 deletions src/main/java/io/reactivex/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,70 @@

package io.reactivex;

import java.util.*;
import java.util.concurrent.*;

import org.reactivestreams.Publisher;

import io.reactivex.annotations.*;
import java.util.Collection;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not unroll star imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor Author

@VovaStelmashchuk VovaStelmashchuk May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akarnokd Maybe you can include some rule for the import bloc to CONTRIBUTING.md ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jordan1997

When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible.

But don't worry, we will warn you if there is a stylistic problem.

import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import io.reactivex.annotations.BackpressureKind;
import io.reactivex.annotations.BackpressureSupport;
import io.reactivex.annotations.CheckReturnValue;
import io.reactivex.annotations.Experimental;
import io.reactivex.annotations.NonNull;
import io.reactivex.annotations.SchedulerSupport;
import io.reactivex.disposables.Disposable;
import io.reactivex.exceptions.Exceptions;
import io.reactivex.functions.*;
import io.reactivex.internal.functions.*;
import io.reactivex.functions.Action;
import io.reactivex.functions.BiConsumer;
import io.reactivex.functions.BiFunction;
import io.reactivex.functions.BiPredicate;
import io.reactivex.functions.BooleanSupplier;
import io.reactivex.functions.Cancellable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.functions.Function3;
import io.reactivex.functions.Function4;
import io.reactivex.functions.Function5;
import io.reactivex.functions.Function6;
import io.reactivex.functions.Function7;
import io.reactivex.functions.Function8;
import io.reactivex.functions.Function9;
import io.reactivex.functions.Predicate;
import io.reactivex.internal.functions.Functions;
import io.reactivex.internal.functions.ObjectHelper;
import io.reactivex.internal.fuseable.ScalarCallable;
import io.reactivex.internal.observers.*;
import io.reactivex.internal.operators.flowable.*;
import io.reactivex.internal.operators.mixed.*;
import io.reactivex.internal.observers.BlockingFirstObserver;
import io.reactivex.internal.observers.BlockingLastObserver;
import io.reactivex.internal.observers.ForEachWhileObserver;
import io.reactivex.internal.observers.FutureObserver;
import io.reactivex.internal.observers.LambdaObserver;
import io.reactivex.internal.operators.flowable.FlowableFromObservable;
import io.reactivex.internal.operators.flowable.FlowableOnBackpressureError;
import io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable;
import io.reactivex.internal.operators.mixed.ObservableConcatMapMaybe;
import io.reactivex.internal.operators.mixed.ObservableConcatMapSingle;
import io.reactivex.internal.operators.mixed.ObservableSwitchMapCompletable;
import io.reactivex.internal.operators.mixed.ObservableSwitchMapMaybe;
import io.reactivex.internal.operators.mixed.ObservableSwitchMapSingle;
import io.reactivex.internal.operators.observable.*;
import io.reactivex.internal.util.*;
import io.reactivex.observables.*;
import io.reactivex.observers.*;
import io.reactivex.internal.util.ArrayListSupplier;
import io.reactivex.internal.util.ErrorMode;
import io.reactivex.internal.util.ExceptionHelper;
import io.reactivex.internal.util.HashMapSupplier;
import io.reactivex.observables.ConnectableObservable;
import io.reactivex.observables.GroupedObservable;
import io.reactivex.observers.SafeObserver;
import io.reactivex.observers.TestObserver;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.*;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.schedulers.Timed;

/**
* The Observable class is the non-backpressured, optionally multi-valued base reactive class that
Expand Down Expand Up @@ -84,12 +128,12 @@
* System.out.println("Done!");
* }
* });
*
*
* Thread.sleep(500);
* // the sequence can now be disposed via dispose()
* d.dispose();
* </code></pre>
*
*
* @param <T>
* the type of the items emitted by the Observable
* @see Flowable
Expand Down Expand Up @@ -1278,7 +1322,7 @@ public static <T> Observable<T> concat(
public static <T> Observable<T> concatArray(ObservableSource<? extends T>... sources) {
if (sources.length == 0) {
return empty();
} else
}
if (sources.length == 1) {
return wrap((ObservableSource<T>)sources[0]);
}
Expand All @@ -1305,7 +1349,7 @@ public static <T> Observable<T> concatArray(ObservableSource<? extends T>... sou
public static <T> Observable<T> concatArrayDelayError(ObservableSource<? extends T>... sources) {
if (sources.length == 0) {
return empty();
} else
}
if (sources.length == 1) {
return (Observable<T>)wrap(sources[0]);
}
Expand Down Expand Up @@ -1765,7 +1809,7 @@ public static <T> Observable<T> fromArray(T... items) {
ObjectHelper.requireNonNull(items, "items is null");
if (items.length == 0) {
return empty();
} else
}
if (items.length == 1) {
return just(items[0]);
}
Expand Down Expand Up @@ -9627,7 +9671,7 @@ public final Single<T> lastOrError() {
* Example:
* <pre><code>
* // Step 1: Create the consumer type that will be returned by the ObservableOperator.apply():
*
*
* public final class CustomObserver&lt;T&gt; implements Observer&lt;T&gt;, Disposable {
*
* // The downstream's Observer that will receive the onXXX events
Expand Down Expand Up @@ -12817,10 +12861,10 @@ public final Observable<T> take(long time, TimeUnit unit, Scheduler scheduler) {
public final Observable<T> takeLast(int count) {
if (count < 0) {
throw new IndexOutOfBoundsException("count >= 0 required but it was " + count);
} else
}
if (count == 0) {
return RxJavaPlugins.onAssembly(new ObservableIgnoreElements<T>(this));
} else
}
if (count == 1) {
return RxJavaPlugins.onAssembly(new ObservableTakeLastOne<T>(this));
}
Expand Down