File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Exceptions thrown by ListIterator.add(Object) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exceptions thrown by ListIterator.add(Object)" Watch "Exceptions thrown by ListIterator.add(Object)" New topic

Exceptions thrown by ListIterator.add(Object)

Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
In the API for this method it can be read:
ClassCastException - if the class of the specified element prevents it from being
added to this Set.
IllegalArgumentException - if some aspect of this element prevents it from being
added to this Collection.
But you can't get a ListIterator for a Collection or Set compile-time type so I guess the words Set and Collection should be replaced by List, as in the ListIterator.set() method

SCJP2. Please Indent your code using UBB Code
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Yup, looks like an error. But fortunately it's easy enough to figure out what they meant. You can submit a bug report and your name will become immortalized in Java history.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Exceptions thrown by ListIterator.add(Object)
It's not a secret anymore!