Suppose I have an ArrayList
of my custom Objects which is very simple. For example:
class Account
{
public String Name;
public In
Assuming that it is an unordered list, you will need to iterate over the list and check each object.
for(int i = 0; i < sizeOfList; i++) {
list.get(i).equals(/* What you compare against */)
}
There's also the other for
syntax:
for(Account a : accountList)
You could put this loop into a helper method that takes an Account
and compares it against each item.
For ordered lists, you have more efficient search options, but you will need to implement a search no matter what.