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(...) { ... }
  ...
}
```

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