
Untitled
By: a guest on
May 8th, 2012 | syntax:
Java | size: 0.66 KB | hits: 11 | expires: Never
public boolean isFoundStack(Record record){
IRecordStack tempStackOne=new RecordStack();
IRecordStack tempStackTwo=new RecordStack();
tempStackOne=this.stackOne;
tempStackTwo=this.stackTwo;
boolean found=true;
while (!this.stackOne.isEmpty() && !this.stackOne.top().equals(record)){
tempStackOne.push(this.stackOne.pop());
found=false;
}
this.stackOne=tempStackOne;
if (found){
return found;
}
found=true;
while (!tempStackTwo.isEmpty() && !tempStackTwo.top().equals(record)){
tempStackTwo.push(this.stackOne.pop());
found=false;
}
this.stackTwo=tempStackTwo;
return found;
}