Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CastMap tools (and JDBC assignment)  RSS feed

 
Peter Gragert
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not like a title of spaces only therefore I 'trimmed' strings and this is already available in 'CastMap':
public String getTrimmedString( String key )
{
String returnVal = null ;
String s = (String)get( key );
if ( s == null )
{
returnVal = null ;
}
else
{
returnVal = s.trim();
}
return returnVal ;
}
Isn't it just as clear if one would replace
if-else because of initialization of 'returnVal'
by
if( s != null)
{
returnVal = s.trim();
}
?
 
Marilyn de Queiroz
Sheriff
Posts: 9079
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Peter. It's already been changed but the changed jar file isn't available yet. Good catch.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!