diff --git a/src/test/java/lessonA_CreatingObservableStreams.java b/src/test/java/lessonA_CreatingObservableStreams.java index 09c60de..a44fa76 100644 --- a/src/test/java/lessonA_CreatingObservableStreams.java +++ b/src/test/java/lessonA_CreatingObservableStreams.java @@ -136,7 +136,7 @@ public void _4_fromCreatesAnObservableThatEmitsEachElementFromAnIterable() { * So if we are going to build an observable and not subscribe to it until later on, how can we include the all * of the functionality as before? Do we have to put all the work inside subscribe() ? No we don't! *

- * If we peek at the Observer interface we see it has three methods: + * If we peek at the {@link rx.Observer} interface we see it has three methods: *

* public interface Observer { * void onCompleted(); diff --git a/src/test/java/lessonB_MapAndFlatMapAndBasicOperators.java b/src/test/java/lessonB_MapAndFlatMapAndBasicOperators.java index 0feb5be..a6866e6 100644 --- a/src/test/java/lessonB_MapAndFlatMapAndBasicOperators.java +++ b/src/test/java/lessonB_MapAndFlatMapAndBasicOperators.java @@ -90,9 +90,13 @@ public Observable call(List foods) { /** Was the result above what you expected? A bit strange huh? You'd think that you'd get * a value matching the number of items of foods in each list at first glance. * The reason we get a different result is because of the difference between map(), and flatmap(), which we will see next. + * * map() will always keep the SAME NUMBER OF events/ data as the previous segment in the pipeline. It can never change the number * of items on the previous piece of the pipeline. - + * + * In other words, our call to map() applies a function to each item in the foodcartItemsObservable. + * Within this function, we return Observable(s), of type carnivalFood, for each item in our foodcartItemsObservable. + * * Next, we would like to begin filtering the list to match what we can afford to eat. * The problem now is that rather than Observable items, we are emitting Observable>s instead. * We can't filter these, because Observable has no price (its content does, but we cant access that). diff --git a/src/test/java/lessonC_BooleanLogicAndErrorHandling.java b/src/test/java/lessonC_BooleanLogicAndErrorHandling.java index 85a8582..c93bee3 100644 --- a/src/test/java/lessonC_BooleanLogicAndErrorHandling.java +++ b/src/test/java/lessonC_BooleanLogicAndErrorHandling.java @@ -73,8 +73,10 @@ public void _1_takeWhileEvaluatesAnExpressionAndEmitsEventsUntilItReturnsFalse() * * Riddle: Lets define our elevator rule: the total weight of all passengers aboard an elevator may not be larger than 500 pounds. * How!?! - * Hint: Check out the Public methods available on LessonResources.Elevator and passenger! - */ + * + * Hint: Check out the Public methods available on + * {@link LessonResources.Elevator} and {@link LessonResources.ElevatorPassenger}! + * */ Func1 elevatorRule = passenger -> ____ + ____ < ____; /** @@ -104,6 +106,8 @@ public void _1_takeWhileEvaluatesAnExpressionAndEmitsEventsUntilItReturnsFalse() */ mSubscriber = new TestSubscriber<>(); // + // Lets start by emptying our elevator + // elevator.unload(); // ??? // // assertThat(mSubscriber.getOnNextEvents()).hasSize(3); diff --git a/src/test/java/lessonD_AdvancedStreams.java b/src/test/java/lessonD_AdvancedStreams.java index e73a64a..afc9160 100644 --- a/src/test/java/lessonD_AdvancedStreams.java +++ b/src/test/java/lessonD_AdvancedStreams.java @@ -14,14 +14,14 @@ public class lessonD_AdvancedStreams { private String mEvenNums = ""; private String mOddNums = ""; - /* - So far everything has been pretty linear. Our pipelines all took the form: - "do this, then do this, then do this, then end". In reality we can combine pipelines. We can take two streams - and turn them into a single stream. - - Now its worth nothing this is different from what we did when we nested Observables. In that case we always had one stream. - Lets take a stream of integers and a stream of strings and join them. - */ + /** + * So far everything has been pretty linear. Our pipelines all took the form: + * "do this, then do this, then do this, then end". In reality we can combine pipelines. We can take two streams + * and turn them into a single stream. + * + * Now its worth noting this is different from what we did when we nested Observables. In that case we always had one stream. + * Lets take a stream of integers and a stream of strings and join them. + */ @Test public void _1_merging() { Observable you = Observable.just(1, 2, 3); @@ -32,15 +32,15 @@ public void _1_merging() { assertThat(mReceived).isEqualTo(_____); } - /* - We can also split up a single stream into two streams. We are going to to use the groupBy() action. - This action can be a little tricky because it emits an observable of observables. So we need to subscribe to the - "parent" observable and each emitted observable. - - We encourage you to read more from the wiki: http://reactivex.io/documentation/operators/groupby.html - - Lets split up a single stream of integers into two streams: even and odd numbers. - */ + /** + * We can also split up a single stream into two streams. We are going to use the groupBy() action. + * This action can be a little tricky because it emits an observable of observables. So we need to subscribe to the + * "parent" observable and each emitted observable. + * + * We encourage you to read more from the wiki: http://reactivex.io/documentation/operators/groupby.html + * + * Lets split up a single stream of integers into two streams: even and odd numbers. + */ @Test public void _2_splittingUp() { Observable.range(1, 9) @@ -62,12 +62,12 @@ public void _2_splittingUp() { } - /* - Lets take what we know now and do some cool stuff. We've setup an observable and a function for you. Lets combine - them together to average some numbers. - - Also see that we need to subscribe first to the "parent" observable but that the pipeline still cold until we - subscribe to each subset observable. Don't forget to do that. + /** + * Lets take what we know now and do some cool stuff. We've setup an observable and a function for you. Lets combine + * them together to average some numbers. + * + * Also see that we need to subscribe first to the "parent" observable but that the pipeline still cold until we + * subscribe to each subset observable. Don't forget to do that. */ @Test public void _3_challenge_needToSubscribeImmediatelyWhenSplitting() { @@ -86,4 +86,4 @@ public void _3_challenge_needToSubscribeImmediatelyWhenSplitting() { assertThat(averages[0]).isEqualTo(22.0); assertThat(averages[1]).isEqualTo(100.0); } -} \ No newline at end of file +} diff --git a/src/test/java/solutions/lessonB_Solutions.java b/src/test/java/solutions/lessonB_Solutions.java index efae5f9..830e349 100644 --- a/src/test/java/solutions/lessonB_Solutions.java +++ b/src/test/java/solutions/lessonB_Solutions.java @@ -190,6 +190,7 @@ public void composableFunctions() { .subscribe(); assertThat(mStringA).isEqualTo("123456"); assertThat(mStringB).isEqualTo("246"); + //assertThat(mStringC).isEqualTo("112233445566"); // Uncommenting this will produce errors } /**