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() -

c# - Making TableLayoutPanel Act Like An HTML Table (Cells That Resize Automatically Around Text) -