Mike Savvy wrote:Hi there!
. . .
Thank you for advices!
Swapna latha wrote:
Thank you very much Ankit. I do have one more doubt, i am confused about api aslo before and after for compose and andThen method. But your way of explanation is vrey good.
Ankit Garg wrote:The order is quite simple, when you use compose, the inner function is called first, then the outer function is called with the result of the inner function.
Let's create two methods which we'll call with and without Lambda:
EDIT - modifying the example to change return type
Now lets call them without Lambda
This code calls the intToStr function with an Integer value, the resulting String is passed to the strToLong function which converts the String value to Long. In simple terms, with Lambda this can be achieved in two ways (below lines are not code but just explaining the API)
strToLong.compose(intToStr)
OR
intToStr.andThen(strToLong)
[Edit]
Another important point is the resulting function that you get when you call compose. In the above case, after calling compose (or andThen but with reverse parameters), you get a function which takes an Integer as parameter and returns a Long. The way it happens is, first intToStr is called which takes the integer and converts it into a String, then strToLong is called and it converts the String to Long. So it would work something like this
intToLong = strToLong.compose(intToStr);
Integer i = 20;
Long l = intToLong(i)
Namith Kumar wrote:Thanks Vivz Sharma. Great point about summarizing a chapter.
Vivz Sharma wrote:Namith, I still go old school way of writing down the key points into a book chapter wise of course and at the end you have a summary from the book to check whether you missed out on any point or no. One important thing I want to say is for some it many be easy point to memorize and for you it is not then try to challenge yourself that you haven't forgotten any key points from previous chapters.
Happy Learning
Campbell Ritchie wrote:Does that mean you sent that information to Oracle/PearsonVue?
Mikalai Zaikin wrote:Hi Surya,
Out of curiosity, did you manage to apply the promo code ?
Thanks,
MZ