I have a list of clients and on a certain screen the user can search and edit the clients of the list that is very extensive, comparing these two examples what would be the best to work?
Example 1:
for (int i = 0, tamI = listAll.size(); i< tamI;i++)
if (listAll.get(i).getNome().toLowerCase().startsWith(query.toLowerCase()))
listResult.add(listAll.get(i));
Example 2:
for (Cliente item : listAll)
if(item.getNome().toLowerCase().startsWith(query.toLowerCase()))
listResult.add(item);