On Jul 18, 2017 11:39 AM, "Gary Gregory" <garydgreg...@gmail.com> wrote:

My use case is to write a Properties object in sorted key order, nothing
fancy. The simplest way is to subclass Properties and override keys().

Loading a SortedProperties with a Map is not on my to-do list.




Would your use case be served by one or more static methods?
These methods might need as  arguments:
1) Some form of output sink
2) An instance of Map<?,?> m satisfying the conditions:
   a) every key in m is an instance of String.
   b) every value in m is an instance of String.

The constraints 2a and 2b   are required   be satisfied by any Properties
object  any time at  it is output.

(Because of the legacy derivation from Hashtable, these  conditions may be
violated at other times without an error being signaled. This also makes
the concept of a Sorted Properties instance problematic, as these
keys/values may be comparable with String.)

There might be different entry points for sorted output, and for output in
the natural order of the map (which might  be sorted).

There may need to be a specialized default comparator if parts of the keys
are to be compared in non lexicographic order (for example, if  a key
contains sequences of digits that should be compared as numbers, or if keys
are hierarchical, with components  separated by periods).

Values need to be encoded wrt the special escape format defined for
properties files.

As a separate set of functionality, a corresponding method or set of
methods could be provided to support populating a Map from an input source
containing contents formatted as specified in j.u.Properties.

So,  io with a touch of codec?

Simon

Reply via email to