Article View: borland.public.jbuilder.java.language
Article #17487Re: Collections sub-class
From: Hubert A. Klein Ikkink
Date: Tue, 03 Nov 1998 00:00
Date: Tue, 03 Nov 1998 00:00
30 lines
1490 bytes
1490 bytes
Hi Jason,
you can build your own class extended from Object. Store String members in
Vector object inside the class. Define your own elementAt, etc. methods.
For example:
public class StringVector extends Object {
Vector strings = new Vector();
public String elementAt(int index) {
return (String)strings.elementAt(index);
}
...
}
--
Groetjes,
Hubert A. Klein Ikkink, aka Mr.Haki
E-mail: hubertk@worldonline.nl
Website: http://www.drbob42.com/jbuilder
Jason Burton wrote:
> I would like to make a class using the collections framework that is a
> List/Vector of Strings rather than of Objects, so that a typecast doesn't
> need to be made when getting/setting elements. I wish I could override the
> get/elementAt methods to return a different type, but that isn't possible.
> Anyone have any clean implementation ideas?
>
> Thanks,
> Jason Burton
Technical Details
Message-ID:
<363F7FEE.A86C20CA@worldonline.nl>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<71nofl$8j31@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,e93759e00fd3c52b X-Google-Attributes: gidf74b3,public From: "Hubert A. Klein Ikkink" <hubertk@worldonline.nl> Subject: Re: Collections sub-class Date: 1998/11/03 Message-ID: <363F7FEE.A86C20CA@worldonline.nl> X-Deja-AN: 408074790 Content-Transfer-Encoding: 7bit References: <71nofl$8j31@forums.borland.com> To: Jason Burton <jasonb@tmscorp.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: www.drbob42.com Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language