Doubt about Comparator interface implementation


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Doubt about Comparator interface implementation

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    16

    Doubt about Comparator interface implementation

    When u implement a interface u should implement all it's methods.

    But when we implement Comparator interface u can leave the equals()

    method . where this method is implemented? (A Interface can't

    implement it's method ...)

    please Help me ...........

  2. #2
    Join Date
    Mar 2004
    Posts
    635
    You don't have to implement all the methods of an interface (though you often should)

    But when we implement Comparator interface u can leave the equals()
    leave the equals() where? you mean leave it out? clarify what you're talking about.

  3. #3
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    The equals method is defined for the Object class, so every class you make in Java will use the inherited method if its not implemented in the class itself. If you only need the Comparator interface to facilitate sorting, then the equals method does not come into play.
    eschew obfuscation

Similar Threads

  1. ADo.Net Concurrency doubt
    By sunilbenjamin in forum .NET
    Replies: 1
    Last Post: 06-13-2005, 01:58 PM
  2. Doubt in Remoting - C#
    By vijay in forum .NET
    Replies: 0
    Last Post: 02-26-2003, 07:31 AM
  3. Replies: 0
    Last Post: 09-03-2001, 05:12 AM
  4. Replies: 0
    Last Post: 01-16-2001, 01:21 AM
  5. Winpopup implementation
    By Camilo Torres in forum VB Classic
    Replies: 2
    Last Post: 10-18-2000, 11:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center