This commit is contained in:
Grzegorz Piwowarek 2017-08-02 00:05:37 +02:00
parent b0e05630ea
commit 8214c8dd97
2 changed files with 2 additions and 15 deletions

View File

@ -11,12 +11,6 @@ public class toLength implements Transformer<String, Integer> {
@Override
public Observable<Integer> call(Observable<String> source) {
return source.map(new Func1<String, Integer>() {
@Override
public Integer call(String str) {
return str.length();
}
});
return source.map(String::length);
}
}

View File

@ -96,14 +96,7 @@ public class RxJavaCustomOperatorUnitTest {
@Test
public void whenUseFunctionTransformer_thenSuccess() {
final Transformer<String, Integer> toLengthFn = source -> {
return source.map(new Func1<String, Integer>() {
@Override
public Integer call(String str) {
return str.length();
}
});
};
final Transformer<String, Integer> toLengthFn = source -> source.map(String::length);
final List<Integer> results = new ArrayList<Integer>();
Observable.from(Arrays.asList("apple", "orange"))