While getting my daily fix of feed, I found this post on javablogs, describing a "bug" that crawled into the code because a design decision.

The problem they actually had was conceptual one, more than technical. The Comparable interface is meant to be implemented if there is an ordering that inherent to the class (ie, numbers, words, days of week, months, seasons). In their case, ordering by name is not inherent to the SelectablePerson class (you may want to sort by any other field in the future).

I'll follow with another Java quirk in my next post.

1 TrackBack

TrackBack URL: http://tech.soronthar.com/mt/mt-tb.cgi/47

Hostgator Review from Hostgator Review on November 10, 2013 3:57 AM

Comparable vs. Comparator: A response - Soronthar's Software Development Diary Read More

1 Comment

| Leave a comment

Leave a comment