wood burning stoves 2.0*
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 Java 8 in Action this week in the Java 8 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exceptions thrown by ListIterator.add(Object)
 
Similar Threads
Question on Collections
garbage collection
JSTL and collection manipulations
Static fields in Entity Bean
ArrayList without duplicates