Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to ensure unique key in property file  RSS feed

 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to ensure that a UNIQUE key is set into the property file always.
prop.storeProperty(key,value);
 
Joe Ess
Bartender
Posts: 9428
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The key will always be unique. If you try to store a value to an existing key, the new value will overwrite the existing value. The key does not get duplicated.
If you want to make sure values are not overwritten, you can just check to see if the key exists before storing it.
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks alot Joe
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!