Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1080283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:00:22+00:00 2026-05-16T22:00:22+00:00

My question is Interface Set has method add(E e) and it extends interface Collection

  • 0

My question is

Interface Set has method add(E e) and it extends interface Collection.
Interface Collection also has method add(E e)
So why do we need the same method in interface Set , since it already extends interface Collection.
What is the purpose ?
I am stuck with that

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:00:22+00:00Added an answer on May 16, 2026 at 10:00 pm

    Since the two correct answers didn’t manage to convince you, I’ll try to explain.

    Interfaces define contracts – i.e. they define what implementors are going (and bound) to do, so that you know that whenever you refer to an object by an interface, it has a strictly defined behaviour, no matter how exactly it has been implemented.

    Now, this contract comes in two parts:

    • method signature – the method signature is the element that is enforced by the compiler – all implementors must conform to the all method signatures defined by the interface
    • documented behaviour – when there is more to a method than its method signature, the special behaviour is documented. It again tells the client of the interface what to expect from all implementors, although it does not technigally force implementors to conform to it.

    And here comes the concrete Collection / Set example:

    • if you are referring to an object as a Collection, then you don’t know anything of the behaviour of add – whether it allows duplicates or not
    • if you are referring to an object as a Set, then you are certain that no duplicates are allowed.

    This distinction is made by the javadoc of the redefined add method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A question was raised in a discussion I had around whether an interface method
I have an interesting question about interface builder and ARC. I am building a
Simple question: Is there a class or interface that encapulates the getting of a
following on from this question (Developing to an interface with TDD), I'm still having
So in a previous question I asked about implementing a generic interface with a
My question is: How to captuare an incoming IP packet from a network interface,
my question is rather simple, if you have an pure virtual class (interface) but
Short question. I just got a dll I'm supposed to interface with. Dll uses
I have small question by entity framework 4.1. There is interface of image DTO:
My first question =). I'm writing a video game with a user interface written

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.