New to mobile development and thought I'd follow along with this tutorial. This is hopefully a simple question. If someone could just tell me what the --> is called (is it a pointer?) or what causes the (e) --> code to be light gray in color after typed, I could do some more research on my own problem here.
youtube.com/watch?v=RagA8g9A5Qc
In the video link below at 10:58 (pause video) you will see some code showing
uploadTask.addOnFailureListener ((e) --> { {finish(); }};
at 10:42 in the video you see similar symbol
`mProfileImage.setOnClickListener((view) --> {saveUserInformation(); }};`
Could someone please advise what the --> is called and how I might get the (e) --> to appear in the auto-populate functions dialog box as you start typing? Am I missing a file or class?
I think it might be an IDE settings since just above those lines of code in his video you see the following line:
- bitmap.compress(Bitmap.CompressFormat.JPEG, 20, baos);
but in my IDE I see the word "quality"
- bitmap.compress(Bitmap.CompressFormat.JPEG, quality 20, baos);
appear when the value 20 was typed. It's a light grey color similar to the (e) and --> in his code which for some reason won't work in my editor or code.
Basically, (e) -> {...}
is a lambda, you can read more about this here https://kotlinlang.org/docs/reference/lambdas.html, but it's, in basic terms, a block of code that can be executed. The e
is the parameter coming from the caller and the ->
is just syntax to denote the lambda followed by the code, the "quality" in grey letters that you mention is just the name of a parameter in the compress
method, which the IDE shows so you can properly fill method calls without looking up the docs or the source.
EDIT: Also, bear in mind it should be ->
not -->
, in both Java and Kotlin, that could be the source of your "grey letters" issue.