Passing NULL Objects



Hello everyone.  I have the following:

//Perform a search for the account number
public BankAccount searchAccounts (Vector<BankAccount> bankAccounts , long accountNumber){
int accNum=0;
for(int x=0;x<bankAccounts.size();x++){
if(bankAccounts.elementAt(x) == accountNumber){
return ?? //I want to return the object that matches from the Vector to the calling function
else
return ?? //How do I return a NULL object (The reason is that I can test for it in the returning function)
}



So...returning null objects. Any thoughts? :-) .



Relevant Pages

  • Re: Passing NULL Objects
    ... public BankAccount searchAccounts (VectorbankAccounts, long accountNumber){int accNum=0; ... //I want to return the object that matches from the Vector to the calling function else return ?? ...
    (comp.lang.java.help)
  • Re: Passing NULL Objects
    ... public BankAccount searchAccounts (VectorbankAccounts, long accountNumber){int accNum=0; ... //I want to return the object that matches from the Vector to the calling function else return ?? ...
    (comp.lang.java.help)
  • Re: Passing NULL Objects
    ... > public BankAccount searchAccounts (VectorbankAccounts, ... > long accountNumber){ ... > Vector to the calling function ...
    (comp.lang.java.help)
  • Re: else without if error
    ... > looks like correct code to me...what did I miss? ... > public BankAccount searchAccounts (VectorbankAccounts, ... > long accountNumber){ ... > I was also reading about the new for-each style loop in java. ...
    (comp.lang.java.help)
  • Re: else without if error
    ... >public BankAccount searchAccounts (VectorbankAccounts, ... >long accountNumber){ ... Tell your IDE to put {on a new line. ... The visual pattern will make ...
    (comp.lang.java.help)