Netflix/RxJava — pull request #784 by benjchristensen (2014-01-25 00:48:33+00:00)
Title: Lift and Observer+Subscription

Make `Observer` implement `Subscription` and rename `bind` to `lift` as per decisions in https://github.com/Netflix/RxJava/issues/775

Signatures are now:

```java
// Observable.create
public final static Observable create(OnSubscribe f)

// Observable.OnSubscribe typed function interface
public static interface OnSubscribe extends Action1>

// lift function
public Observable lift(final Func1, Observer> bind)

// Observer
public abstract class Observer implements Subscription {
public abstract void onNext(T t);
public abstract void onError(Throwable e);
public abstract void onCompleted();
public final void add(Subscription s)
public final void unsubscribe()
public final boolean isUnsubscribed()
}

// Subject
public abstract class Subject extends Observer {
public abstract Observable toObservable();
}
```

This is a major set of changes to the internals, particularly the unit tests because Mockito has issues with abstract classes as opposed to `Observer` being an interface.

There are still some unit tests failing that I haven't yet figured out:

- OperationJoinsTest.whenComplicated in rxjava-core
- OperationConditionalsTest.testDoWhileManyTimes in rxjava-computation-expressions
- OperationConditionalsTest.testWhileDoManyTimes in rxjava-computation-expressions

I intend on merging this sooner rather than later so everyone can be working off the same codebase, even though I do not consider this code ready for release, even once those unit tests are fixed.

Interestingly, these performance tests on my machine are much better:

```java
// OperatorFromIterablePerformance.timeTenLongs()
v0.16
* Run: 10 - 8,096,667 ops/sec
* Run: 11 - 8,382,131 ops/sec
* Run: 12 - 8,256,288 ops/sec
* Run: 13 - 8,139,703 ops/sec
* Run: 14 - 8,011,023 ops/sec

... after v0.17 work:

* Run: 10 - 31,296,553 ops/sec
* Run: 11 - 30,080,435 ops/sec
* Run: 12 - 31,886,941 ops/sec
* Run: 13 - 32,281,807 ops/sec
* Run: 14 - 33,519,028 ops/sec

// OperatorMapPerformance.timeMapPlusOne();

v0.16

* Run: 10 - 11,375,632 ops/sec
* Run: 11 - 11,390,325 ops/sec
* Run: 12 - 11,655,527 ops/sec
* Run: 13 - 11,528,440 ops/sec
* Run: 14 - 11,321,181 ops/sec

... after v0.17 work:

* Run: 10 - 17,674,464 ops/sec
* Run: 11 - 17,890,239 ops/sec
* Run: 12 - 17,919,155 ops/sec
* Run: 13 - 16,356,974 ops/sec
* Run: 14 - 16,723,414 ops/sec

// OperatorMergePerformance.timeRepetitionsEmissionSynchronous()

v0.16

* Run: 10 - 32,609,617 ops/sec
* Run: 11 - 33,511,839 ops/sec
* Run: 12 - 34,768,096 ops/sec
* Run: 13 - 32,376,499 ops/sec
* Run: 14 - 33,166,835 ops/sec

... after v0.17 work:

* Run: 10 - 45,945,747 ops/sec
* Run: 11 - 46,342,209 ops/sec
* Run: 12 - 44,493,090 ops/sec
* Run: 13 - 44,999,640 ops/sec
* Run: 14 - 47,389,771 ops/sec

```