Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4880711

(prefs) Preferences does not have means to store and retrieve arrays

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • Fix Understood
    • x86
    • windows_nt

      Name: jl125535 Date: 06/18/2003


      A DESCRIPTION OF THE REQUEST :
      Preferences API do not have means to store or retrieve String, int and other types of arrays. Since storing arrays are one of the most frequently used features, it would be of great benefit if Preferences API had support for this.

      Example:

      Preferences prefs = Preferences.systemRoot();
      prefs.putArray("possibleColors", new String[]{"red", "yellow", "green", "blue", "black"});
      String[] colors = prefs.getArray("possibleColors");

      prefs.putIntArray("possibleValues", new int[]{0, 1, 2});
      int[] values = prefs.getIntArray("possibleValues");



      JUSTIFICATION :
      Since storing and retrieval of arrays are one of the most frequently used features, it would be of great benefit if Preferences API had support for this.



      CUSTOMER SUBMITTED WORKAROUND :
      At present, you can work around this feature as storing a comma separated value and parsing upon retrieval.

      Example:

      Preferences prefs = Preferences.systemRoot();
      prefs.put("possibleColors", "red, yellow, green, blue, black");
      String colorsList = prefs.get("possibleColors");

      String[] colors = parseCommas(colorList);
      (Review ID: 182638)
      ======================================================================
      ###@###.### 11/3/04 20:41 GMT

            sherman Xueming Shen
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: