java - interface extends comparable -


possible duplicate:
java: difference between implementing comparable , comparator?

difference between comparable interface , comparator interface , use?example?

comparable makes object intrinsically comparable other objects.

comparator allows implement external comparison logic, can applied objects not comparable, or require different logic default comparison logic.

for example, have collections.sort(list), can sort lists of objects implement comparable, while there method - collections.sort(list, comparator), can sort list.


Comments

Popular posts from this blog

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

c++ - Convert big endian to little endian when reading from a binary file -