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][SUBMIT] TypedList
Date Tue, 23 Apr 2002 19:57:57 GMT

From: Henri Yandell <bayard@generationjava.com>
> > > What is the point of the wrap method?
> > >
> > > Can I do:
> > >     List list = TypedList(new LinkedList());   ????
> >
> > Yes, but the syntax is
> > List list = TypedList.wrap(new LinkedList());
> > However, as noted above, the iterator is based on AbstractList - not
much
> > use for LinkedList. I'll see if I can fix this ;-)
>
> Little unsure what you're saying. Sounds like the only difference is that
> you use a factory method where I tend to use a constructor. I love doing:
>
> List list = new LimitedList( new SortedList( new LinkedList() ) );

The specification for List (and other collections) 'requests' that all
implementations should have a constructor that takes in a Collection object
(to do an addAll). I was respecting this by not confusing the constructors.
Also, I may need constructors to do the simple instanceof check, thus named
statics work more easily.

> I don't recall how to use reflection on static methods, only problem I
> could think of with 'wrap'.

Simply specify null, where you would specify the object in the invoke.

Stephen

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


--
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