This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Well, to be fair, the Collection interface lists the method as optional. It can throw an UnsupportedOperationException in some cases. So in truth, there is no general answer to Imran's last question; it depends on the specific Collection implementation that we are talking about. Most collections implement this method, but a few, like the implementations returned by Collections.unmodifiableXXX() and Arrays.asList(), do not. The idea of optional methods in an interface is a bit odd, and in Java I think it's unique to the collections framework. Generally an interface promises that a method will be available in an implementing class. But with an optional method, the promise is that the method will be present in the class, but it may throw an exception. So the method is available, except that it really isn't.
"I'm not back." - Bill Harding, Twister
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com