Link to home
Start Free TrialLog in
Avatar of ericworldz
ericworldz

asked on

check element exists in a list collection

how to check if an element exists in a list?

i have a private instance var : private List account;

// the list start with an index of 0, -1 to prevent IndexOutOfBoundsException
         int _accountNumber = accountNumber - 1;
         Account _account = (Account) account.get(_accountNumber);

how to check that _accountNumber does exist in the account list? if not i want to throw an exception error.

thanks!
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial