Devendra Walanj wrote:
There are special cases, such as casting and "optional methods", but the above is the general idea.
What are these special cases.
Optional Methods ! ... heard for the first time, can you please elaborate ?
Look in the javadoc for java.util.AbstractList - you will find notations on several methods in that for (optional operation).
I think this was a bad idea. I suppose the Java Gods that did this had their reasons, but I think an optional operation renders the interface MUCH weaker than it was. Before "optional operations", you were protected against run-time errors due to unimplemented code, which was a large part of the whole point behind a strongly typed language. Now, if someone decides to replace a library and they happen to use lists (sound likely?), it is possible that code that worked before won't work now, because the caller depended on these optional operations, and there is no way I know of to tell whether a particular implementation supplies them or not.
rc