Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Question about java.util.Set

Reply
Thread Tools

Question about java.util.Set

 
 
Zhao
Guest
Posts: n/a
 
      10-24-2003
I noticed that java.util.Set extends java.util.Collection and
all the abstract methods of Collection is redeclare in java.util.Set.

Why? It is not necessary since java.util.Set inheritant all this methods
already, why do we need to redeclare them? Similar codes appear in other
Collection interfaces like List.

thanks

Zhao
 
Reply With Quote
 
 
 
 
Michael Borgwardt
Guest
Posts: n/a
 
      10-24-2003
Zhao wrote:
> I noticed that java.util.Set extends java.util.Collection and
> all the abstract methods of Collection is redeclare in java.util.Set.
>
> Why? It is not necessary since java.util.Set inheritant all this methods
> already, why do we need to redeclare them? Similar codes appear in other
> Collection interfaces like List.


Indeed this is technically unnecessary but was probably done in order to be
able to give more specific javadoc comments in the derived interfaces.

 
Reply With Quote
 
 
 
 
John C. Bollinger
Guest
Posts: n/a
 
      10-24-2003
Zhao wrote:

> I noticed that java.util.Set extends java.util.Collection and
> all the abstract methods of Collection is redeclare in java.util.Set.
>
> Why? It is not necessary since java.util.Set inheritant all this methods
> already, why do we need to redeclare them? Similar codes appear in other
> Collection interfaces like List.


Michael's response is pretty good, but why not read what Sun itself has
to say about the matter in Set's API docs:

The Set interface places additional stipulations, beyond those inherited
from the Collection interface, on the contracts of all constructors and
on the contracts of the add, equals and hashCode methods. Declarations
for other inherited methods are also included here for convenience. (The
specifications accompanying these declarations have been tailored to the
Set interface, but they do not contain any additional stipulations.)


Similar statements appear in the API docs of the other interfaces of the
collections framework.


John Bollinger
http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
question row filter (more of sql query question) =?Utf-8?B?YW5kcmV3MDA3?= ASP .Net 2 10-06-2005 01:07 PM
Quick Question - Newby Question =?Utf-8?B?UnlhbiBTbWl0aA==?= ASP .Net 4 02-16-2005 11:59 AM
Question on Transcender Question :-) eddiec MCSE 6 05-20-2004 06:59 AM
Question re: features of the 831 router (also a 924 question) Wayne Cisco 0 03-02-2004 07:57 PM
Syntax Question - Novice Question sean ASP .Net 1 10-20-2003 12:18 PM



Advertisments