Skip to content

Commit 24be900

Browse files
committed
Improved documentation of the BehaviourSubject.
1 parent 0aaf151 commit 24be900

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

rxjava-core/src/main/java/rx/subjects/BehaviorSubject.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
*/
1616
package rx.subjects;
1717

18-
import static org.mockito.Matchers.any;
19-
import static org.mockito.Mockito.mock;
20-
import static org.mockito.Mockito.times;
21-
import static org.mockito.Mockito.verify;
18+
import static org.mockito.Matchers.*;
19+
import static org.mockito.Mockito.*;
2220

2321
import java.util.concurrent.ConcurrentHashMap;
2422
import java.util.concurrent.atomic.AtomicReference;
@@ -35,7 +33,7 @@
3533
import rx.util.functions.Func1;
3634

3735
/**
38-
* Subject that publishes the previous and all subsequent events to each {@link Observer} that subscribes.
36+
* Subject that publishes the last and all subsequent events to each {@link Observer} that subscribes.
3937
* <p>
4038
* Example usage:
4139
* <p>
@@ -61,6 +59,15 @@
6159
*/
6260
public class BehaviorSubject<T> extends Subject<T, T> {
6361

62+
/**
63+
* Creates a {@link BehaviorSubject} which publishes the last and all subsequent events to each
64+
* {@link Observer} that subscribes to it.
65+
*
66+
* @param defaultValue
67+
* The value which will be published to any {@link Observer} as long as the
68+
* {@link BehaviorSubject} has not yet received any events.
69+
* @return the constructed {@link BehaviorSubject}.
70+
*/
6471
public static <T> BehaviorSubject<T> createWithDefaultValue(T defaultValue) {
6572
final ConcurrentHashMap<Subscription, Observer<T>> observers = new ConcurrentHashMap<Subscription, Observer<T>>();
6673

0 commit comments

Comments
 (0)