I committed a simple SortedProperties class to [collections]. It's goal as
Javadoc'd is only to sort keys.

Tracking with: [COLLECTIONS-654] Add class SortedProperties to sort keys.

Gary

On Tue, Jul 18, 2017 at 3:50 PM, Jonathan Bluett-Duncan <
jbluettdun...@gmail.com> wrote:

> >
> > Yes, of course, that's one way to go and also create a bunch of methods
> to
> > delegate to the wrapped Properties... BUT I cannot pass this object to a
> > method typed with "Properties".
> >
>
> Oh, that's a fair point. You've convinced me. :)
>
> On 18 July 2017 at 23:44, Gary Gregory <garydgreg...@gmail.com> wrote:
>
> > On Tue, Jul 18, 2017 at 11:27 AM, Jonathan Bluett-Duncan <
> > jbluettdun...@gmail.com> wrote:
> >
> > > I would strongly discourage subclassing `Properties` and instead I'd
> > > encourage composing it into the proposed `SortedProperties` class, as
> > > subclassing classes which weren't designed for inheritance is risky
> > > according to Effective Java 2nd Edition, Items 16 and 17.
> > >
> > > So for example:
> > > ```
> > > public final class SortedProperties {
> > >   private final Properties properties;
> > >   ...
> > >   public static SortedProperties from(Properties properties,
> > > Comparator<...> keyComparator) {
> > >     ...
> > >     return new SortedProperties(...);
> > >   }
> > >   private SortedProperties(...) { ... }
> > >   ...
> > > }
> > > ```
> > >
> >
> > Yes, of course, that's one way to go and also create a bunch of methods
> to
> > delegate to the wrapped Properties... BUT I cannot pass this object to a
> > method typed with "Properties".
> >
> > Gary
> >
> >
> > > On 18 July 2017 at 19:25, Rob Tompkins <chtom...@gmail.com> wrote:
> > >
> > > >
> > > >
> > > > > On Jul 18, 2017, at 4:43 AM, Jörg Schaible
> > <joerg.schaible@bpm-inspire.
> > > > com> wrote:
> > > > >
> > > > > Hi Gary,
> > > > >
> > > > > Gary Gregory wrote:
> > > > >
> > > > >> Hi,
> > > > >>
> > > > >> I'd to have a new class called SortedProperties that extends
> > > > >> java.util.Properties.
> > > > >>
> > > > >> Should that go in [lang] or [collections]?
> > > > >>
> > > > >> I first thought [lang], but it _is_ a collection after all.
> > > > >>
> > > > >> Gary
> > > > >
> > > > > for me it's [collections]. [collections] is like [lang] also an
> > > > extension to
> > > > > the Java runtime, specialized for the collection/map/array stuff of
> > > > > java.util. Especially since we tried to strip [lang] down and have
> > > > already
> > > > > moved stuff now into more specialized components.
> > > >
> > > > I'm stuck in the in-between here with the following thought:
> HashTable
> > > > certainly feels like a collection of objects, but it clearly extends
> > > > Dictionary and isn't in the collections family. But we are in
> java.util
> > > > here and not in java.lang, so that feels more like it could be in
> > > > collections. Plus properties are essentially a map, despite they're
> > being
> > > > implemented on top of hashtable.
> > > >
> > > > -Rob
> > > >
> > > > >
> > > > > Cheers,
> > > > > Jörg
> > > > >
> > > > >
> > > > > ------------------------------------------------------------
> > ---------
> > > > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > > > > For additional commands, e-mail: dev-h...@commons.apache.org
> > > > >
> > > >
> > > > ------------------------------------------------------------
> ---------
> > > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > > > For additional commands, e-mail: dev-h...@commons.apache.org
> > > >
> > > >
> > >
> >
>

Reply via email to