• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Arrays.asLIit() casting exception (JDK 1.4)

 
FY Hsieh
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have



First I want to mention this is not jdk 1.5 or beyond, it is 1.4.
The compilation is OK but gives run time exception of Class Cast for "Arrays.asList()" part. what's wrong and how should I fix it ?

Thanks.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It returns a List, not an ArrayList, no?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
asLIit()?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, it's like asList, but more learned, and in Olde English.

http://shakespearelang.sourceforge.net/report/shakespeare/
 
Steve Fahlbusch
Bartender
Posts: 605
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,

i saw your reply and laughed good 10 minutes. :-) Thank you
 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:It returns a List, not an ArrayList, no?

Actually it does return an ArrayList, just not java.util.ArrayList. The returned class is java.util.Arrays.ArrayList, a private static class inside class java.util.Arrays. But yeah, you're right that as far as the API is concerned, it does return a List.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic