![]() ![]() Provide a convenient way to create unmodifiable sets. Such exceptions are marked as "optional" in the specification for this The insertion of an ineligible element into the set may throw anĮxception or it may succeed, at the option of the implementation. Operation on an ineligible element whose completion would not result in ![]() Or it may simply return false some implementations will exhibit the formerīehavior and some will exhibit the latter. To query the presence of an ineligible element may throw an exception, NullPointerException or ClassCastException. Attempting toĪdd an ineligible element throws an unchecked exception, typically For example, some implementations prohibit null elements,Īnd some have restrictions on the types of their elements. Some set implementations have restrictions on the elements that That it is not permissible for a set to contain itself as an element. Is changed in a manner that affects equals comparisons while the The behavior of a set is not specified if the value of an object Note: Great care must be exercised if mutable objects are used as setĮlements. That all constructors must create a set that contains no duplicate elements The additional stipulation on constructors is, not surprisingly, Not contain any additional stipulations.) (The specifications accompanying theseĭeclarations have been tailored to the Set interface, but they do Declarations for other inherited methods areĪlso included here for convenience. Inherited from the Collection interface, on the contracts of allĬonstructors and on the contracts of the add, equals and The Set interface places additional stipulations, beyond those Its name, this interface models the mathematical set abstraction. More formally, setsĬontain no pair of elements e1 and e2 such thatĮ1.equals(e2), and at most one null element. A collection that contains no duplicate elements. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |