1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-23 09:22:19 -05:00

DeckAdapter: cache field lookups

This commit is contained in:
Sebastian Kaspari 2010-03-21 16:05:52 +01:00
parent 9a89262714
commit e3d13a3880

View File

@ -99,8 +99,12 @@ public class DeckAdapter extends BaseAdapter
*/ */
public int getPositionByName(String name) public int getPositionByName(String name)
{ {
for (int i = 0; i < conversations.size(); i++) { // Optimization - cache field lookups
if (conversations.get(i).getName().equalsIgnoreCase(name)) { int mSize = conversations.size();
LinkedList<Conversation> mItems = this.conversations;
for (int i = 0; i < mSize; i++) {
if (mItems.get(i).getName().equalsIgnoreCase(name)) {
return i; return i;
} }
} }