Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

com.javaranch.common - CastMap.getString(...)

 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How does get( key ) work when no HashTable has been populated or even declared?
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi:
fyi:
Class HashMap;
Class HashMap;
HashMap
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does get( key ) work when no HashTable has been populated or even declared?
How's it goin' Doco? Do you mean HashMap? That's what your code shows. A HashMap will return null, a HashTable will throw an NPE. So for your getString() method, the String "null" would be returned.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually a HashTable won't compile since it is a Hashtable.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic