Skip to content

Commit f082889

Browse files
author
jmhofer
committed
Merge remote-tracking branch 'parent/master' into timestamp
2 parents ad45868 + 96d38a3 commit f082889

14 files changed

+867
-97
lines changed

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# RxJava Releases #
22

3+
### Version 0.8.1 ([Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.netflix.rxjava%22%20AND%20v%3A%220.8.1%22)) ###
4+
5+
* [Pull 250](https://github.com/Netflix/RxJava/pull/250) AsyncSubject
6+
* [Pull 252](https://github.com/Netflix/RxJava/pull/252) ToFuture
7+
* [Pull 246](https://github.com/Netflix/RxJava/pull/246) Scheduler.schedulePeriodically
8+
* [Pull 247](https://github.com/Netflix/RxJava/pull/247) flatMap aliased to mapMany
9+
310
### Version 0.8.0 ([Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.netflix.rxjava%22%20AND%20v%3A%220.8.0%22)) ###
411

512
This is a breaking (non-backwards compatible) release that updates the Scheduler implementation released in 0.7.0.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=0.8.1-SNAPSHOT
1+
version=0.8.2-SNAPSHOT

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 144 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
import rx.operators.OperationConcat;
4343
import rx.operators.OperationDefer;
4444
import rx.operators.OperationDematerialize;
45-
import rx.operators.OperationGroupBy;
4645
import rx.operators.OperationFilter;
4746
import rx.operators.OperationFinally;
47+
import rx.operators.OperationGroupBy;
4848
import rx.operators.OperationMap;
4949
import rx.operators.OperationMaterialize;
5050
import rx.operators.OperationMerge;
@@ -64,7 +64,7 @@
6464
import rx.operators.OperationTakeLast;
6565
import rx.operators.OperationTakeUntil;
6666
import rx.operators.OperationTakeWhile;
67-
import rx.operators.OperationTimestamp;
67+
import rx.operators.OperationToFuture;
6868
import rx.operators.OperationToIterator;
6969
import rx.operators.OperationToObservableFuture;
7070
import rx.operators.OperationToObservableIterable;
@@ -617,9 +617,11 @@ public void call(Object args) {
617617

618618
/**
619619
* Returns a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
620-
*
621-
* @param subject the subject to push source elements into.
622-
* @param <R> result type
620+
*
621+
* @param subject
622+
* the subject to push source elements into.
623+
* @param <R>
624+
* result type
623625
* @return a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
624626
*/
625627
public <R> ConnectableObservable<R> multicast(Subject<T, R> subject) {
@@ -1199,6 +1201,8 @@ public R call(T t1) {
11991201
* and then merges the results of that function applied to every item emitted by the original
12001202
* Observable, emitting these merged results as its own sequence.
12011203
* <p>
1204+
* Note: mapMany and flatMap are equivalent.
1205+
* <p>
12021206
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
12031207
*
12041208
* @param sequence
@@ -1213,6 +1217,7 @@ public R call(T t1) {
12131217
* @return an Observable that emits a sequence that is the result of applying the transformation
12141218
* function to each item emitted by the source Observable and merging the results of
12151219
* the Observables obtained from this transformation
1220+
* @see {@link #flatMap(Observable, Func1)}
12161221
*/
12171222
public static <T, R> Observable<R> mapMany(Observable<T> sequence, Func1<T, Observable<R>> func) {
12181223
return create(OperationMap.mapMany(sequence, func));
@@ -1378,6 +1383,62 @@ public static <T> Observable<T> finallyDo(Observable<T> source, Action0 action)
13781383
return create(OperationFinally.finallyDo(source, action));
13791384
}
13801385

1386+
/**
1387+
* Creates a new Observable sequence by applying a function that you supply to each object in the
1388+
* original Observable sequence, where that function is itself an Observable that emits objects,
1389+
* and then merges the results of that function applied to every item emitted by the original
1390+
* Observable, emitting these merged results as its own sequence.
1391+
* <p>
1392+
* Note: mapMany and flatMap are equivalent.
1393+
* <p>
1394+
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
1395+
*
1396+
* @param sequence
1397+
* the source Observable
1398+
* @param func
1399+
* a function to apply to each item emitted by the source Observable, generating a
1400+
* Observable
1401+
* @param <T>
1402+
* the type emitted by the source Observable
1403+
* @param <R>
1404+
* the type emitted by the Observables emitted by <code>func</code>
1405+
* @return an Observable that emits a sequence that is the result of applying the transformation
1406+
* function to each item emitted by the source Observable and merging the results of
1407+
* the Observables obtained from this transformation
1408+
* @see {@link #mapMany(Observable, Func1)}
1409+
*/
1410+
public static <T, R> Observable<R> flatMap(Observable<T> sequence, Func1<T, Observable<R>> func) {
1411+
return mapMany(sequence, func);
1412+
}
1413+
1414+
/**
1415+
* Creates a new Observable sequence by applying a function that you supply to each object in the
1416+
* original Observable sequence, where that function is itself an Observable that emits objects,
1417+
* and then merges the results of that function applied to every item emitted by the original
1418+
* Observable, emitting these merged results as its own sequence.
1419+
* <p>
1420+
* Note: mapMany and flatMap are equivalent.
1421+
* <p>
1422+
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
1423+
*
1424+
* @param sequence
1425+
* the source Observable
1426+
* @param func
1427+
* a function to apply to each item emitted by the source Observable, generating a
1428+
* Observable
1429+
* @param <T>
1430+
* the type emitted by the source Observable
1431+
* @param <R>
1432+
* the type emitted by the Observables emitted by <code>func</code>
1433+
* @return an Observable that emits a sequence that is the result of applying the transformation
1434+
* function to each item emitted by the source Observable and merging the results of
1435+
* the Observables obtained from this transformation
1436+
* @see {@link #mapMany(Observable, Func1)}
1437+
*/
1438+
public static <T, R> Observable<R> flatMap(Observable<T> sequence, final Object func) {
1439+
return mapMany(sequence, func);
1440+
}
1441+
13811442
/**
13821443
* Groups the elements of an observable and selects the resulting elements by using a specified function.
13831444
*
@@ -2032,6 +2093,19 @@ public Boolean call(T t, Integer integer)
20322093
}));
20332094
}
20342095

2096+
/**
2097+
* Return a Future representing a single value of the Observable.
2098+
* <p>
2099+
* This will throw an exception if the Observable emits more than 1 value. If more than 1 are expected then use <code>toList().toFuture()</code>.
2100+
*
2101+
* @param that
2102+
* the source Observable
2103+
* @returna Future that expects a single item emitted by the source Observable
2104+
*/
2105+
public static <T> Future<T> toFuture(final Observable<T> that) {
2106+
return OperationToFuture.toFuture(that);
2107+
}
2108+
20352109
/**
20362110
* Returns an Observable that emits a single item, a list composed of all the items emitted by
20372111
* the source Observable.
@@ -2115,11 +2189,15 @@ public static <T> Iterable<T> mostRecent(Observable<T> source, T initialValue) {
21152189

21162190
/**
21172191
* Returns a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
2118-
*
2119-
* @param source the source sequence whose elements will be pushed into the specified subject.
2120-
* @param subject the subject to push source elements into.
2121-
* @param <T> source type
2122-
* @param <R> result type
2192+
*
2193+
* @param source
2194+
* the source sequence whose elements will be pushed into the specified subject.
2195+
* @param subject
2196+
* the subject to push source elements into.
2197+
* @param <T>
2198+
* source type
2199+
* @param <R>
2200+
* result type
21232201
* @return a connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.
21242202
*/
21252203
public static <T, R> ConnectableObservable<R> multicast(Observable<T> source, final Subject<T, R> subject) {
@@ -2128,7 +2206,7 @@ public static <T, R> ConnectableObservable<R> multicast(Observable<T> source, fi
21282206

21292207
/**
21302208
* Returns the only element of an observable sequence and throws an exception if there is not exactly one element in the observable sequence.
2131-
*
2209+
*
21322210
* @param that
21332211
* the source Observable
21342212
* @return The single element in the observable sequence.
@@ -2698,6 +2776,48 @@ public Boolean call(T t1) {
26982776
});
26992777
}
27002778

2779+
/**
2780+
* Creates a new Observable sequence by applying a function that you supply to each item in the
2781+
* original Observable sequence, where that function is itself an Observable that emits items, and
2782+
* then merges the results of that function applied to every item emitted by the original
2783+
* Observable, emitting these merged results as its own sequence.
2784+
* <p>
2785+
* Note: mapMany and flatMap are equivalent.
2786+
* <p>
2787+
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
2788+
*
2789+
* @param func
2790+
* a function to apply to each item in the sequence, that returns an Observable.
2791+
* @return an Observable that emits a sequence that is the result of applying the transformation
2792+
* function to each item in the input sequence and merging the results of the
2793+
* Observables obtained from this transformation.
2794+
* @see {@link #mapMany(Func1)}
2795+
*/
2796+
public <R> Observable<R> flatMap(Func1<T, Observable<R>> func) {
2797+
return mapMany(func);
2798+
}
2799+
2800+
/**
2801+
* Creates a new Observable sequence by applying a function that you supply to each item in the
2802+
* original Observable sequence, where that function is itself an Observable that emits items, and
2803+
* then merges the results of that function applied to every item emitted by the original
2804+
* Observable, emitting these merged results as its own sequence.
2805+
* <p>
2806+
* Note: mapMany and flatMap are equivalent.
2807+
* <p>
2808+
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
2809+
*
2810+
* @param callback
2811+
* a function to apply to each item in the sequence that returns an Observable.
2812+
* @return an Observable that emits a sequence that is the result of applying the transformation'
2813+
* function to each item in the input sequence and merging the results of the
2814+
* Observables obtained from this transformation.
2815+
* @see {@link #mapMany(Object)}
2816+
*/
2817+
public <R> Observable<R> flatMap(final Object callback) {
2818+
return mapMany(callback);
2819+
}
2820+
27012821
/**
27022822
* Filters an Observable by discarding any of its emissions that do not meet some test.
27032823
* <p>
@@ -2834,13 +2954,16 @@ public R call(T t1) {
28342954
* then merges the results of that function applied to every item emitted by the original
28352955
* Observable, emitting these merged results as its own sequence.
28362956
* <p>
2957+
* Note: mapMany and flatMap are equivalent.
2958+
* <p>
28372959
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
28382960
*
28392961
* @param func
28402962
* a function to apply to each item in the sequence, that returns an Observable.
28412963
* @return an Observable that emits a sequence that is the result of applying the transformation
28422964
* function to each item in the input sequence and merging the results of the
28432965
* Observables obtained from this transformation.
2966+
* @see {@link #flatMap(Func1)}
28442967
*/
28452968
public <R> Observable<R> mapMany(Func1<T, Observable<R>> func) {
28462969
return mapMany(this, func);
@@ -2852,13 +2975,16 @@ public <R> Observable<R> mapMany(Func1<T, Observable<R>> func) {
28522975
* then merges the results of that function applied to every item emitted by the original
28532976
* Observable, emitting these merged results as its own sequence.
28542977
* <p>
2978+
* Note: mapMany and flatMap are equivalent.
2979+
* <p>
28552980
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/mapMany.png">
28562981
*
28572982
* @param callback
28582983
* a function to apply to each item in the sequence that returns an Observable.
28592984
* @return an Observable that emits a sequence that is the result of applying the transformation'
28602985
* function to each item in the input sequence and merging the results of the
28612986
* Observables obtained from this transformation.
2987+
* @see {@link #flatMap(Object))}
28622988
*/
28632989
public <R> Observable<R> mapMany(final Object callback) {
28642990
@SuppressWarnings("rawtypes")
@@ -3393,11 +3519,14 @@ public <E> Observable<T> takeUntil(Observable<E> other) {
33933519
}
33943520

33953521
/**
3396-
* Adds a timestamp to each item emitted by this observable.
3397-
* @return An observable sequence of timestamped items.
3522+
* Return a Future representing a single value of the Observable.
3523+
* <p>
3524+
* This will throw an exception if the Observable emits more than 1 value. If more than 1 are expected then use <code>toList().toFuture()</code>.
3525+
*
3526+
* @returna Future that expects a single item emitted by the source Observable
33983527
*/
3399-
public Observable<Timestamped<T>> timestamp() {
3400-
return create(OperationTimestamp.timestamp(this));
3528+
public Future<T> toFuture() {
3529+
return toFuture(this);
34013530
}
34023531

34033532
/**

0 commit comments

Comments
 (0)