DroidKaigi / conference-app-2017

The Official Conference App for DroidKaigi 2017 Tokyo
Apache License 2.0
470 stars 140 forks source link

Change for statement. #370

Closed kitwtnb closed 7 years ago

kitwtnb commented 7 years ago

Issue

Overview (Required)

Links

Thank for @eneim ! I learned a lot. 😇
Is this OK?

konifar commented 7 years ago

👀 @kitwtnb Awesome! Thanks for quick fix! LGTM @eneim Can you review?

jmatsu commented 7 years ago

What do you mean by every time?

for (Some some: createSomeList()) {
  ...
}

is equal to

for (Iterator iterator = createSomeList().iterator(); iterator.hasNext();) {
  Some some = (Some) myIterator.next();
  ...
}

The number of instance creations is same with the current one.

eneim commented 7 years ago

@konifar @kitwtnb sorry for the late reply, my exp is exactly as the following article: link to Medium. It was from 2015, but still a good practice to reference. Please take a look at the whole. I will try some profiling in current code base though.

konifar commented 7 years ago

@eneim Does this PR look good for you? 🤔

eneim commented 7 years ago

Ah sorry, @konifar @kitwtnb this looks good to me for the onDraw :D. FYI there are few steps to improve this class if you are really crazy about the performance. But don't spend too much time, I just want to mention a general practice :D.

konifar commented 7 years ago

Thanks! 👍