posted 24 years ago
The following is an exerpt from theMagelang Institute :
In the creation of the Collections Framework, the Sun development team needed to provide flexible interfaces that manipulated groups of elements. To keep the design simple, instead of providing separate interfaces for optional capabilities, the interfaces define all the methods an implementation class may provide. However, some of the interface methods are optional. Because an interface implementation must provide implementations for all the interface methods, there needed to be a way for a caller to know if an optional method is not supported. The manner the framework development team chose to signal callers when an optional method is called was to thrown an UnsupportedOperationException.
It says that some of the interface methods are optional. It also says that an interface implementation must provide implementations for all the interface methods. Aren't the two statements contradictory and isn't the 1st statement wrong.
Can someone help me understand what is being said in the above parragraph.