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 (and objects ) is quite loose that one implementation can apply to both archive , object and set

For example, the addition method does not throttle an exception, when trying to add an object that is already there, it is just false (instead of true ) This is already allowed by Collection.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

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -