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

File.lineSeparator() to retrieve value of commonly used "line.separator" system property

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Duplicate
    • P5
    • None
    • 6
    • core-libs
    • x86
    • windows_xp

    Description

      A DESCRIPTION OF THE REQUEST :
      The JDK should provide a method which returns the (cached) value of System.getProperty("line.separator").

      JUSTIFICATION :
      Many developers end up keeping their own cached copy of getProperty("line.separator"), to avoid the hash table lookup upon every access. It makes sense for the JDK to provide a method which does this, for three reasons:
      1. Correctness - It's easy to misspell "line.separator", and the compiler won't check it for you, so you won't find out you misspelled it until runtime.

      2. Performance - Currently, many applications call getProperty("line.separator") every time they want to use the system line separator. This is a performance issue because a hash table lookup occurs when calling getProperty. Having a method which returned a cached copy of the property would make it easy to achieve good performance in this regard.

      3. Ease of use & cross-platform development - It's easier to type \n than it is to create a new field to store the value of the system property, so many developers do this, which breaks cross-platform compatibility. Making it easy to retrieve the line separator will make it easier to write cross-platform compatible applications.
      ###@###.### 2005-05-02 18:11:27 GMT

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: