commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@eurobell.co.uk>
Subject Re: [Collections] Naming conventions
Date Thu, 13 Jun 2002 22:03:00 GMT
From: Michael A. Smith <mas@apache.org>
> On Thu, 13 Jun 2002, Stephen Colebourne wrote:
> > 2) Subclassing would be more complex. Currently each Predicate decorator
> > implementation extends another based on the interface hierarchy. In
order to
> > continue this, the static nested classes would need to be package
scoped,
> > not private. Not a big issue, but it should be noted.
>
> Maybe I'm misunderstanding what you mean here, but this compiles just
> fine:
>
> public class Foo {
>   private static class Bar {
>   }
>   private static class Baz extends Bar {
>   }
> }
>
> The Bar class is private outside its scope of Foo, but since Baz is in
> the scope of Foo, it can still see Bar.

What you describe does indeed compile, but isn't the proposal. The following
demonstrates (I hope) why they need to be package scoped.

public class CollectionUtils {
  public static Collection predicatedCollection(Collection coll) {
    return new PredicatedCollection(coll);
  }
  static class PredicatedCollection {
  }
}
public class ListUtils {
  public static List predicatedList(List list) {
    return new PredicatedList(list);
  }
  static class PredicatedList extends PredicatedCollection {
  }
}

> > 3) Defining the relationship between ListUtils and Lists,
CollectionUtils
> > and Collections and MapUtils and Maps. Unfortunately, ListUtils,
> > CollectionUtils and MapUtils are @since 1.0, so we are not free to
rename
> > them.
> >
> >
> > After a little thought, I think I favour adding Utils to all of the
above.
> > Results in no clashes with Java, and just involves adding methods to
> > ListUtils, CollectionUtils and MapUtils.
>
> I haven't fully digested this thread yet, but I'm inclined to agree with
> you.

It is quite a lot to digest, but given the number of ideas that are floating
about, we do seem to need it. There could be some work for the committers to
manage the patches etc. for any renaming however!

Stephen



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message