Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking null

Status
Not open for further replies.

timmbo

Programmer
Feb 22, 2001
167
US
Hi All,

I'm trying to check my code for null at if(_wireRecords.elementAt(i + 1) != null). But it keeps blowing right through it. How would I accomplish this?

public void RecordSorter(Vector _wireRecords) {
LogManager.sysLog(5, this, "Entering RecordSorter Constructor()");

Vector holdInfo = new Vector();

for(int i = 0; _wireRecords.size() > i; i++) {
WireRecord wr = (WireRecord)_wireRecords.elementAt(i);

System.out.println("Start...");
String acctNum = wr.getAccountNum();
String wireNum = wr.getWireNum();
Double amount = wr.getAmount();

System.out.println("Before...");

if(_wireRecords.elementAt(i + 1) != null) {
WireRecord nextWireRec = (WireRecord)_wireRecords.elementAt(i + 1);
System.out.println("After...");
}
System.out.println("Done...");
}

TIA,
Tim
 
So you're seeing multiple 'Start...' and 'Before...' lines, but no 'After...' lines?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top