Article View: borland.public.jbuilder.java.api
Article #673Re: ArrayList.toArray() gives class cast exception
From: Shankar Unni
Date: Wed, 16 Apr 2003 17:16
Date: Wed, 16 Apr 2003 17:16
8 lines
1506 bytes
1506 bytes
Gillmer J. Derge [TeamB] wrote: > Because that method creates an Object array not an Item array. And the reason this is done this way is that an ArrayList can contain any type of object, so there's definitely no guarantee that all the objects are of one type. Only you (the programmer) knows this, which is why you have to ask for it explicitly if you want a typed array.
Technical Details
Message-ID:
<3e9d9004$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mailReferences:
<3e9cff00@newsgroups.borland.com> <3e9d5513$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,5c0e8f08630b5fc1 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-04-16 10:22:37 PST Date: Wed, 16 Apr 2003 10:16:52 -0700 From: Shankar Unni <shankar@cotagesoft.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4a) Gecko/20030401 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.api Subject: Re: ArrayList.toArray() gives class cast exception References: <3e9cff00@newsgroups.borland.com> <3e9d5513$1@newsgroups.borland.com> In-Reply-To: <3e9d5513$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 64.165.207.59 Message-ID: <3e9d9004$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1050513412 64.165.207.59 (16 Apr 2003 10:16:52 -0700) Lines: 9 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mail