From 6f35c10aab9ddac81a7e3fff5f0e326892d3a31c Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Fri, 26 Mar 2010 17:38:47 +0000 Subject: [PATCH] HADOOP-6654. Fix code example in WritableComparable javadoc. Contributed by Tom White git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@927979 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ .../org/apache/hadoop/io/WritableComparable.java | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 155a3a0e18..e761d82c74 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -303,6 +303,9 @@ Trunk (unreleased changes) HADOOP-6645. Re: Bugs on listStatus for HarFileSystem (rodrigo via mahadev) + HADOOP-6654. Fix code example in WritableComparable javadoc. (Tom White + via szetszwo) + Release 0.21.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/src/java/org/apache/hadoop/io/WritableComparable.java b/src/java/org/apache/hadoop/io/WritableComparable.java index b8aaf731cc..8e31dafdfc 100644 --- a/src/java/org/apache/hadoop/io/WritableComparable.java +++ b/src/java/org/apache/hadoop/io/WritableComparable.java @@ -28,7 +28,9 @@ * *

Example:

*

- *     public class MyWritableComparable implements WritableComparable {
+ *     public class MyWritableComparable implements
+ *         WritableComparable<MyWritableComparable> {
+ *
  *       // Some data
  *       private int counter;
  *       private long timestamp;
@@ -43,10 +45,10 @@
  *         timestamp = in.readLong();
  *       }
  *       
- *       public int compareTo(MyWritableComparable w) {
- *         int thisValue = this.value;
- *         int thatValue = ((IntWritable)o).value;
- *         return (thisValue < thatValue ? -1 : (thisValue==thatValue ? 0 : 1));
+ *       public int compareTo(MyWritableComparable other) {
+ *         int thisValue = this.counter;
+ *         int thatValue = other.counter;
+ *         return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
  *       }
  *     }
  *