Here you can find the source of getPrefsStrings(Preferences prefs, String key)
public static String[] getPrefsStrings(Preferences prefs, String key)
//package com.java2s; import java.util.ArrayList; import java.util.prefs.Preferences; public class Main { public static String[] getPrefsStrings(Preferences prefs, String key) { ArrayList<String> arr = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String s = prefs.get(key + (i + 1), null); if (s == null) break; arr.add(s);//from w w w .j a v a 2 s. co m } return arr.toArray(new String[arr.size()]); } }