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