In this case . . . |
||
![]() Cpt SAJChurchey The empty string check in this case is negligible, but what about in the other functions where a lot more operations are being performed on the data. I condensed some of the code and called trim() before reverse() was called, in case of input w/ large amounts of leading/trailing whitespace. public String backwards(String input)
{
if(input == null)
{
throw new IllegalArgumentException("null not supported");
}//end if
StringBuffer buffer = new StringBuffer(input.trim());
return buffer.reverse().toString();
}
Cpt SAJChurchey
C/O of Editorial OSI Staff edit0r OSI Feedback Representative Replies:
|
||
| CyberArmy::Forum v0.6 Generated In 0.02282 seconds |