Created
March 24, 2017 07:20
-
-
Save NightlyNexus/ff5c1e8f9e7c567efb349d499460d973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class View { | |
Data data; | |
void setData(Data data) { | |
this.data = data; | |
setOnClickListener(v -> run(data)); | |
} | |
} | |
class View { | |
Data data; | |
private final View.OnClickListener clickListener = new OnClickListener() { | |
@Override public void onClick(View v) { run(data);} | |
}; | |
{ setOnClickListener(clickListener); } | |
void setData(Data data) { this.data = data; } | |
} |
I mean, how many objects does Picasso.load allocate while I'm flinging?
But, every piece counts, and I should reduce waste when I know it's going to be used in this manner. 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The former allocates on every invocation of bind. When flinging you don't want it to waste time allocating in the draw path.