This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exceptions thrown by ListIterator.add(Object)" Watch "Exceptions thrown by ListIterator.add(Object)" New topic
Author

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
Wanderer
Sheriff

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
 
jQuery in Action, 2nd edition
 
subject: Exceptions thrown by ListIterator.add(Object)
 
Similar Threads
ArrayList without duplicates
garbage collection
Question on Collections
JSTL and collection manipulations
Static fields in Entity Bean