Reputation: 22173
I need to save a list of strings using Java preferences but there isn't any API to save a list. Am I missing anything? Is there a common way to do it?
Upvotes: 2
Views: 933
Reputation: 170745
I assume you mean java.util.prefs.Preferences
? There is no built-in solution, just store them under keys (e.g.) "0"
, "1"
, etc. and write some methods to simplify working with such nodes. Alternately, consider using a library such as Apache Config or Typesafe Config.
Upvotes: 3