getting rid of temp
In the following code please advise how can I get rid of the temp variable tempVar. It looks ugly and I cant think of a way to get rid of it.
String tempVar = getAttrVale(header);
String GBSNum = ((tempVar==null)||tempVar.length()<1)?"":tempVar;
[325 byte] By [
AndreaGyma] at [2007-11-26 15:39:40]

Write a method to do that stuff:private String fixup(String input) {
return input==null ? "" : input;
}
and call it:String GBSNum = fixup(getAttrVale(header));
Note that I removed the redundant test from that code; no point in saying "If the string is an empty string then return the empty string" if you're about to return the string itself anyway.