Subversion
Written by: Lorna Jane Mitchell
Featured Refcardz: Top Refcardz:
  1. Git
  2. DNS
  3. Data Mining
  4. Spring Data
  5. Subversion
  1. Spring Data
  2. Subversion
  3. Spring Config.
  4. Spring Annotations
  5. Data Mining

Link Details

Link 821247 thumbnail
User 744713 avatar

By hstaudacher
via eclipsesource.com
Published: Jul 17 2012 / 04:49

A common task in object oriented programming is comparing two objects for the purpose of sorting. In Java the useful Comparable> Interface exists. I’ve found myself implementing the compareTo method from this Interface plenty of times. But there is something that bothers me everytime: the complexity of the code this implementation creates. Let me explain. One of my goals is to always write easily readable code. But this is really hard when implementing a compareTo method for an object with more than two fields. Let’s take a look at an example.
  • 18
  • 0
  • 1475
  • 1190

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.