Core Spring Data
Written by: Oliver Gierke
Featured Refcardz: Top Refcardz:
  1. Git
  2. Prep for CD
  3. DNS
  4. Data Mining
  5. Spring Data
  1. Data Mining
  2. Spring Data
  3. DNS
  4. Machine Learning
  5. MongoDB

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
  • 1467
  • 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.