Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Arrays.asLIit() casting exception (JDK 1.4) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Arrays.asLIit() casting exception (JDK 1.4)" Watch "Arrays.asLIit() casting exception (JDK 1.4)" New topic
Author

Arrays.asLIit() casting exception (JDK 1.4)

FY Hsieh
Ranch Hand

Joined: Aug 07, 2006
Posts: 73
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

Joined: Sep 29, 2008
Posts: 12617

It returns a List, not an ArrayList, no?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

asLIit()?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yeah, it's like asList, but more learned, and in Olde English.

http://shakespearelang.sourceforge.net/report/shakespeare/
Steve Fahlbusch
Bartender

Joined: Sep 18, 2000
Posts: 557
    
    7

David,

i saw your reply and laughed good 10 minutes. :-) Thank you
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: Arrays.asLIit() casting exception (JDK 1.4)
 
Similar Threads
How to compare ArrayList of objects and get the count?
garbage collection
What is the sequence of persisting for a bidirectional associations?
how to copy the objects from set to the list