Java Set Stipulation -
The following set interface is about Java docs, does anyone help me to understand how these additional conditions Is forced? I mean you can not throw an extra exception which is not thrown by super interface (in this case collection).
The set interface gives additional terms of the additional terms inherited from the archiving interface on contracts of all the constructors and on the contract of contract, add, and hash code methods.
thanks
-Abidi
Conditions are not compelled, they are just added to the contract.
Fortunately the contract for the methods in
archive (andobjects ) is quite loose that one implementation can apply to botharchive ,object andsetFor example, the
addition method does not throttle an exception, when trying to add an object that is already there, it is justfalse (instead oftrue ) This is already allowed byCollection.add :Ensures that there is an element (optional operation) specified in this collection. As the result of the call, this collection has changed, then it becomes correct. (If duplicate is not allowed in this collection and already contains the specified element, then it returns false.)
Comments
Post a Comment