diff --git a/src/main/java/learnrxjava/ComposableListExercises.java b/src/main/java/learnrxjava/ComposableListExercises.java index a13940c..5ccf1c3 100644 --- a/src/main/java/learnrxjava/ComposableListExercises.java +++ b/src/main/java/learnrxjava/ComposableListExercises.java @@ -121,17 +121,9 @@ If our ComposableList had a map() method, it would make projections easier. public ComposableList map(Function projectionFunction) { ComposableListExercises results = new ComposableListExercises(); this.forEach(itemInList -> { - // ------------ INSERT CODE HERE! ---------------------------- - // Apply the projectionFunction to each item in the list and add - // each result to the results list. - // Note that you can apply a projectionFunction to a value like this: - // projectionFunction.apply(5) - // ------------ INSERT CODE HERE! ---------------------------- - + results.add(projectionFunction.apply(itemInList)); }); - - //return results; - throw new UnsupportedOperationException("Not implemented yet."); + return results; } /* @@ -147,9 +139,7 @@ public static ComposableList exercise5() { new Video(65432445, "The Chamber", 4.0), new Video(675465, "Fracture", 5.0)); - // complete this expression - // return newReleases.map(video -> - throw new UnsupportedOperationException("Not implemented yet."); + return newReleases.map(video -> json("id", video.id, "title", video.title)); } /* @@ -187,13 +177,13 @@ public static ComposableList