Can someone explain to me why lambdas can be replaced with a method link here?
In RxJava, map()
takes a parameter of type Func1<T, R>
, whose comment indicates that it "represents a function with argument one ." This way, I fully understand why valueOf(Object)
works here. But trim()
does not accept any arguments at all .
So how does it work?
Observable.just("") .map(s -> String.valueOf(s)) //lambdas .map(s -> s.trim()) // .map(String::valueOf) //method references .map(String::trim) // .subscribe();
source share