简体   繁体   中英

Save a list in preferences

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?

I assume you mean java.util.prefs.Preferences ? There is no built-in solution, just store them under keys (eg) "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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM